It's not a secret anymore!*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes confusion in inner classes 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 "confusion in inner classes" Watch "confusion in inner classes" New topic
Author

confusion in inner classes

Arnab karmakar
Ranch Hand

Joined: Oct 04, 2004
Posts: 46
Hi all ,

When I was studying the Java Tips given by Heather MacKenzie, I got one statement that "You can also define an anonymous class - a class without a name.See p.399 Exam guide for sytax".

When i tried to implement some code following the above statement ... the compiler showed and error ..... identifier expected

My codes are ----
class test27 {
int i;
//inner class
class {
int ii=0;
void m() {
System.out.println(i);
}
}
public static void main(String args[]) {
test27 o = new test27();
}
}

Please tell me whether i am wrong in understanding the statement.
Thankz in advance.

Arnab
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
What did page 399 of the Exam guide say?

Could be you do better reading Corey's Tip on Anonymous Inner Classes


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
What's meant is something like


Apologies if I got some brackets wrong


42
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: confusion in inner classes
 
Similar Threads
a few questions
Exam questions on inner classes -help!
Inner Classes
What's the meaning of the following sentence?
Local Inner Class