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

Define nashorn in java8.

1046


What is the function of character?

1053


What is difference in between java class and bean?

1095


What are the important features of Java 10 release?

988


What is a null point?

1081


What is protected access modifier?

1006


What is class level lock ?

1036


Why singleton pattern is better than creating singleton class with static instance?

1001


What is the public method modifier?

1017


What is an immutable class?

1147


When do we use synchronized methods in java?

1050


When parseint method can be used?

955


What is the point of java?

1029


how we can make a write-only class in java?

1031


why using interface interface ?

2054