• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inner classes

 
Mr Iftikhar
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Fei Ng
Ranch Hand
Posts: 1244
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this if you haven't

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

good luck and happy new.
 
Vikrama Sanjeeva
Ranch Hand
Posts: 760
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Jane Griscti
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
mark stone
Ranch Hand
Posts: 417
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic