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,052 views
asked Jan 9, 2014 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 Jan 9, 2014 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 May 14, 2014 by augustaina Sr Member (4,820 points)

Related questions

0 votes
1 answer 35 views
35 views asked Jan 24, 2014 by sara Guru (24,570 points)
0 votes
1 answer 18 views
18 views asked Jan 5, 2014 by keem Expert (13,240 points)
0 votes
1 answer 60 views
0 votes
1 answer 56 views
0 votes
1 answer 23 views
...