aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Khalid's question on Inner class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Khalid Watch "Khalid New topic
Author

Khalid's question on Inner class

aishwarya mathur
Greenhorn

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

Here "sunil" get printed.Can explain why?
Doyle Matt
Ranch Hand

Joined: Jul 05, 2004
Posts: 76
Inner classes are no my specialty but here goes

new Example().new Inner().doIt();

what this one does is it:
first : creates and object of Example
second: using that object of Example it creates an inner object of Inner
third : using that inner object it calls the doIt function of the Inner object


SCJP 1.4
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Notice that class Object, which your Example class inherits, does not have a member or method called new (I'm talking about the .new). It's a part of the syntax of the java Language which is understood by the compiler.


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
 
subject: Khalid's question on Inner class
 
Similar Threads
Shadowing Variable
Inner class basics. (Marcus Green's mock exam 2)
:rolling: Innovative functions !!!
abstract
Accessing the new method in the anonymous inner class