• Post Reply Bookmark Topic Watch Topic
  • New Topic

Local classes  RSS feed

 
sai donthneni
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a question in local classes. I was wondering that whether a local class has to extend some class so that it can be instantiated outside its context.
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you clarify what you're asking? Are you asking if you can instantiate a local class outside the block where it's defined?
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A local class cannot be instantiated outside of its scope, but it can "live" outside of its scope.

Such an instance cannot be referenced as the local type outside of its scope. However, it can be referenced as a supertype that's defined outside of that scope. For example...

[ March 31, 2006: Message edited by: marc weber ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!