aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Can somebody explain that what's the difference between class and inner class? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Can somebody explain that what Watch "Can somebody explain that what New topic
Author

Can somebody explain that what's the difference between class and inner class?

Storm Zcm
Greenhorn

Joined: Jul 08, 2007
Posts: 10
I find that the inner class's instance variable can't be autoinitialized.
Are there any other differences?

best wishes.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by As Angel:
I find that the inner class's instance variable can't be autoinitialized...

Welcome to JavaRanch!

An instance variable of an inner class should get the same default value (binary zero) as a top-level class. Can you post some code demonstrating what you mean?


"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
sandeep atluri
Ranch Hand

Joined: Apr 19, 2007
Posts: 42
hi As Angel....

a class is an abstract model of a set or a group of things, having a basic set of qualities or properties....

you create instances of objects using the constructors provided by the class.

now...
any such class, if it has another class declared inside its signature... then the class declared inside is called the Inside class or the Inner class.
i.e., any class that is declared inside the curly braces of a previously declared class, is called the inner class to the outer class...

if you declare any new class outside the curly braces of an old class, then the class is not an inner class to the old class...
but if you declare this new class as...



then the newClass is a subclass of the oldClass... not an inner class of the
oldClass....

now ....

about instance variable's........

instance variable's belong to the Object created using the operator....

Instance variables are given default values..... irrespective of where its parent class has been declared....

the point is that they will always be auto initialized....

but local variables are not auto initialized....



understand....


Sandeep Atluri
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Can somebody explain that what's the difference between class and inner class?
 
Similar Threads
Question in K&B Book - protected class
Private
Inner Classes
Passing an object to a method.
Inner Classes