aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes How can anonymous class extend any other class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "How can anonymous class extend any other class?" Watch "How can anonymous class extend any other class?" New topic
Author

How can anonymous class extend any other class?

Hemal Mehta
Ranch Hand

Joined: Nov 16, 2000
Posts: 101
How can anonymous class extend any other class? Can it be done explicitly?
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
The following code shows how to go about making an anonymous class extend any other class.

The output is
anonymous extension of A
A
[ February 07, 2003: Message edited by: Valentin Crettaz ]

SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
Igor Zeta
Ranch Hand

Joined: Nov 12, 2002
Posts: 40
You can't do it explicitly using the extends keyword


ciao<br />Igor Zeta<br />SCJP1.4
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
It is strictly prohibited to use the "extends" and "implements" keywords in an anonymous class declaration.
[ February 07, 2003: Message edited by: Valentin Crettaz ]
 
 
subject: How can anonymous class extend any other class?