aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes creating objects in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "creating objects in java" Watch "creating objects in java" New topic

creating objects in java

Satyajeet Kadam
Ranch Hand

Joined: Oct 19, 2006
Posts: 215

In above example example object is created in different way instead of using Foo f=new Foo(); f.m();
Is it A Annonymous inner class?
Please explain
Srinivasan thoyyeti
Ranch Hand

Joined: Feb 15, 2007
Posts: 557

you are correct. it is Anonymous Inner class.
(new Foo(){ }).m();

we are extending Foo class creating Object of that class. So eventually by inheritance new child of Foo can access m().

Thanks & Regards, T.Srinivasan
SCWCD 1.4(89%), SCJP 5.0(75%)
Have you tried LearnNowOnline?
subject: creating objects in java