aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Please rectify this code on anonymous classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Please rectify this code on anonymous classes" Watch "Please rectify this code on anonymous classes" New topic
Author

Please rectify this code on anonymous classes

aishwarya mathur
Greenhorn

Joined: Sep 03, 2004
Posts: 22
Hi All,

This below code is from Khalid's (Page No 311).I'am trying to understand what are the accessible declarations in anonymous class which extends Base.So I have added some printout statements to check out what variables are accessed and how.But somehow, I'am not able to compile the program.Can you please correct the code.

marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Got errors?

Your System.out.println statements are in the anonymous class body definition. They need to be in a method.

(I know it looks like a method, but you're actually calling the Base constructor, then slipping in a class definition with the braces. So the braces represent a class body -- not a method body.)
[ September 24, 2004: Message edited by: marc weber ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please rectify this code on anonymous classes
 
Similar Threads
Inner Local Classes
static method local classes
finalize() doubt
I have some questions regarding the access in enclosing context of static and non-sta
Doubt in math.round