Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

anonymous classes

 
rachana ravali
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can an anonymous class extend a class or implement an interface?
please explain to me.
i am new to java.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

The short answer to both your questions is yes. In fact if it doesn't do one or the other, you have to give it a name, and it ceases to be anonymous.

You will find this is discussed many a time on the Ranch; different people have different opinions. Look at this thread in the advanced forum, for example.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic