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 / balibalo

to the writer of #29:

what you propose doesn't work because at line where you have t.wish(), Java tries to find the wish() method in the Object class (since t is of type Object). As it doesn't exist in that class, your program fails to compile.
Simple.

Uday version compiles because there is not type unconsistency, but it still is an anonymous class call, hence not a correct answer to the root question (answer being already given: NO, you cannot create an instance of an interface but you can create references of it).

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is mutable object and immutable object?

1093


What is the properties class?

1045


In how many ways we can do exception handling in java?

950


What are the two types of java programming?

1016


Can we declare a static variable inside a method?

966


Explain about doubly linked list

987


EDS (Electronic Data Systems India Pvt Ltd) at Chennai on 16-12-2006.

9165


What does t in java mean?

959


What does I ++ mean?

1020


What is the size of int in 64-bit jvm?

1040


What are selection structures?

953


What is difference between stringbuffer and string?

915


What is abstract class? Explain

1003


Is java platform independent?

935


What is the difference between the boolean & operator and the && operator in java programming?

1003