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 do you mean by scope of variable?

837


What is a vararg?

974


Is hashmap thread safe?

945


How do you do a line break in java?

943


Does java map allow duplicates?

849


Why can't we override private static methods?

932


What is a locale?

1102


What is meant by oops concept in java?

943


What is type parameter in java?

919


What carriage return means?

920


is there a separate stack for each thread in java? : Java thread

941


What is a war file?

1021


Why java is called not pure object oriented language?

979


Does java support function overloading, pointers, structures, unions or linked lists?

1057


What is the difference between access specifiers and access modifiers in java?

1113