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,036 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 30 views
30 views asked Jan 24, 2014 by sara Guru (24,570 points)
0 votes
1 answer 17 views
17 views asked Jan 5, 2014 by keem Expert (13,240 points)
0 votes
1 answer 59 views
0 votes
1 answer 53 views
0 votes
1 answer 22 views
...