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
Explain the key functions of data binding?
What is charat java?
What is a JAR file?
What is jdbc api?
What is a numeric string?
What is sorting algorithm in java?
What is connection class in java?
What is consumer interface?
What is hashmap and map?
What are the six ways to use this keyword?
Write a program to print count of empty strings in java 8?
What is difference between module and function?
Which category the java thread do fall in?
What are invisible components?.
Is boolean a data type in java?