Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

can you create interface instance ?

Answer Posted / nishant

hi Uday,what you've done is, created an annonymous inner
class which is the implementer class of the interface.Here
the refernce variable is of the interface but it is
referencing to the newly created annonymous inner class
instance.
Here the instanceof operator returns true because
annonymous inner class is the implementer of interface and
instanceof always returns true with the same class or its
super class(try using instanceof with Object class, it will
always return true,may the object be of any class).

Is This Answer Correct ?    14 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between class & object?

1019


Explain about static imports in java?

999


How is garbage collection controlled?

1172


What is a method in java?

1055


What is a boolean field?

962


Given a singly linked list, determine whether it contains a loop or not without using temporary space?

988


What is difference between static and final?

1073


Are arrays primitive data types?

1188


Why array is used in java?

975


How an object is serialized in java?

991


Can private class be extended java?

1033


What are data types in programming?

997


Differentiate between nested and inner class in java.

1006


Can we create our own daemon thread?

982


What about abstract classes in java?

1067