search
Login

Categories


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

3.8k questions

4k answers

117 comments

10.7k users

0 votes
3.1k views
asked Guru 27.1k points 31 48 95

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 Guru 39.1k points 10 21 33
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 Sr Member 4.8k points 10 25 31

Related questions

0 votes
1 answer 41 views
41 views
What is the use of anonymous By an "anonymous class", I take it you mean anonymous inner class.
asked sara Guru 24.6k points 29 51 79
0 votes
1 answer 22 views
22 views
asked keem Expert 13.2k points 26 40 57
0 votes
1 answer 70 views
0 votes
1 answer 83 views
0 votes
1 answer 27 views
27 views
asked augustaina Sr Member 4.8k points 10 25 31
...