• Post Reply Bookmark Topic Watch Topic
  • New Topic

class inside another class  RSS feed

 
midhun raj
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
suppose i have



How to create an object of class B inside class D and call its methodB from class D...

Any help is appreciated
 
Harsha Ka
Ranch Hand
Posts: 45
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


 
midhun raj
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks dude that explains it ..thanks
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Inner classes like that are often private; they are considered as specifically supplying services to their enclosing class.
You are not simply creating an object of the inner class like that. You are also creating an instance of its surrounding class.
Static nested classes are often public; you can call new Outer.Inner(...)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!