File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes 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 "Inner Classes" Watch "Inner Classes" New topic
Author

Inner Classes

Lancy Mendonca
Ranch Hand

Joined: Aug 08, 2000
Posts: 54
I am confused with the following terms used in reference to inner classes in the mock exams
- Nested top level inner class
- Member Inner class
- local class
- Local Inner class
Many Thanks


Sun Certified Java Programmer<BR>Oracle Certified DBA
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
- Nested top level inner class = top-level class defined within another top-level class. Kinda like making your own little namespace scope inside a class.
class Outer {
static class Nested {}
}
- Member Inner class = a class defined within another class class which is directly tied to an instance of the outer class. Think of it as a form of composition in which the type of the included object is defined in the holding type.
class Outer {
class Inner {}//no static keyword
}
- local class = not sure. perhaps, this should have been anonymous classes; if so, see below...
- Local Inner class = an inner class which has its instance tied to the scope of a method execution--albeit, the instance of the local class can be accessed outside the method's scope (read Java in a Nutshell for a good explanation).
class Outer {
void outerMethod1() { class Local{} }
}
- Anonymous class = a class without a name. These are very useful with event listeners. Here's an example:
Button b1 = new Button("Hey");
b1.addActionListener( new ActionListener()
{ public void actionPerformed(ActionEvent ae)
{
System.out.println("Oh my, someone hit button 1");
}
});
Lancy Mendonca
Ranch Hand

Joined: Aug 08, 2000
Posts: 54
Thanks a million for the reply
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Inner Classes
 
Similar Threads
Inner classes
error message why?
Inner class
Examples of all the types of inner classes
A basic concept