C Books Guide and List
C++ Books Guide and List
Best Java Books

3,749 questions

4,049 answers

114 comments

10,705 users

What is anonymous inner class ?

0 votes
3,069 views
asked by john Guru (27,140 points)

2 Answers

0 votes
It is an inner class whose name is not written in the outer class and for which only one object is created.
answered by rajesh Guru (39,140 points)
0 votes
An inner class which does not contains any name is called as Anonymous inner class.

import java.awt.*;

import java.awt.event.*;

class FrameDemo extends Frame{

FrameDemo(){

this.setVisible(true);

this.setSize(300,300);

this.setTitle(“Anonymous inner class”);

addWindowListener(new WindowAdapter(){

public void windowClosing(WindowEvent ae){

System.exit(0);

                     }

            });

   }

Public static void main(String[] args){

FrameDemo fd = new FrameDemo();

            }

}
answered by augustaina Sr Member (4,820 points)

Related questions

0 votes
1 answer 37 views
0 votes
1 answer 19 views
19 views asked by keem Expert (13,240 points)
0 votes
1 answer 60 views
0 votes
1 answer 25 views
...