can you create interface instance ?
Answer Posted / kishore emani
Hi Anil, In this case uday sounds good!
As per your consideration if it is an anonymous class then
just remove that interface from our application and try to
compile it won't compile that code.
Here Test is an interface, for which to create the object
we need to provide the complete implementation for that
interface the same thing which uday did.
and again u check it if(t instanceof Test)
it is returning true that means t is an instance for Test.
and here the object is creating in the heap.
at finally here an instance is created for an interface.
| Is This Answer Correct ? | 4 Yes | 7 No |
Post New Answer View All Answers
What does a za z0 9 mean?
Explain importance of inheritance in java?
How do I start learning java?
Explain serialization and deserialization in java?
List primitive java types?
What is hotjava?
What do you mean by byte code?
How to display all the prime numbers between 1 and 100
Why is whitespace important?
why Java does not support multiple inheritances?
How do you reverse a string in java without using string buffer?
Write a program to find maximum and minimum number in array?
What is tree node in java?
What is meant by object?
Why java strings are immutable in nature?