Bookmark Topic Watch Topic
  • New Topic

Instantiating Interface or Abstract Class  RSS feed

 
Arya Pramod
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi Everyone,

In Java, we cannot instantiate an abstract class or an interface using new.

But in the sample code below



The Interface type is getting instantiating in the return statement as an anonymous class in the testMethod()Method.

Can anybody please explain how is the new operator applicable to abstract and interface type as an anonymous class

Thanks In Advance,
Pramod
 
Joe Ess
Bartender
Posts: 9439
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not post the same question more than once. It causes confusion and duplication of effort as the community tries to help everyone.
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Report post to moderator
[ Deleted my response to this duplicate post ]

See how duplicate posts waste our time
[ January 29, 2008: Message edited by: Peter Chase ]
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!