• Post Reply Bookmark Topic Watch Topic
  • New Topic

INNER CLASS problem  RSS feed

 
Arjun Srivastava
Ranch Hand
Posts: 432
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anybody tell me how to instantiate a inner class define inside a main() method
e.g.
class outer{
public static void main(String[] args)
{
class inner
{

}
}
}
 
Jim Hoglund
Ranch Hand
Posts: 525
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try a search on "method local class".

Jim ... ...
 
Naman Patidar
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As we instantiate any other class using new.
Inner innerObj = new Inner(); // this must appear after inner class definition.
 
Campbell Ritchie
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not a "beginning Java" question. Moving thread.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!