aspose 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

Mr Iftikhar
Ranch Hand

Joined: Oct 12, 2001
Posts: 39
I have studied about inner classes
nested inner classes
static inner classes
from Beginning java 2 ( ivor horton ) and
complete reference but i am not getting the concept of inner classes .
Is there any resources which will teach me in the easiest way that how inner classes works.
------------------
java language


java language
Fei Ng
Ranch Hand

Joined: Aug 26, 2000
Posts: 1242
Try this if you haven't

http://www.javaranch.com/campfire/StoryInner.jsp

good luck and happy new.
Vikrama Sanjeeva
Ranch Hand

Joined: Sep 02, 2001
Posts: 756
Start from RHE,then shift on KM.This is what i have followed & got the concept of Inner Class faster than starting from KM.
Bye.
Viki.
------------------
Count the flowers of ur garden,NOT the leafs which falls away!


Count the flowers of your garden, NOT the leafs which falls away!
Prepare IBM Exam 340 by joining http://groups.yahoo.com/group/IBM340Exam/
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
You may also want to check out
the Sun Tutorial on Inner Classes and the the Inner Class Specification
Hope they help.
------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform
Co-author Mike Meyers' Java 2 Certification Passport


Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
mark stone
Ranch Hand

Joined: Dec 18, 2001
Posts: 417
actually there is nothing very difficult about Inner class. I know the books make it sound like one.
Inner class is nothing but just like a class but inside the parenthesis of another class.
(a)
class TopLevel {
class Inner1 {your code here}
}
(b)
class TopLevel {
static Inner2{your code here}
}
Inner2 is not an innner class. It is as good as another TopLevel class. So basically inner class cannot have the static access modifier.
The third kind is when class is defined inside another method or block
(c)
somemethod() {
class Inner3{code here}
}
ok got it now. just read some rules that are to be followed when we use such classes.
Once you get these 3 types then go and read Anonymous class. but first get the 3 types clear.
One more thing look how the *.class files appear (do a ls or dir) when you compile your classes.
Hope now you get the big picture. any further assistance i would be glad to help as this helps me as well clear my basics. I am learning too, so we can help one another.
markstone23@yahoo.com

Originally posted by Mr Iftikhar:
I have studied about inner classes
nested inner classes
static inner classes
from Beginning java 2 ( ivor horton ) and
complete reference but i am not getting the concept of inner classes .
Is there any resources which will teach me in the easiest way that how inner classes works.

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Inner classes