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
Which sorting algorithm is best in java?
What is the arraylist in java?
What is broken and continue statement?
Can we execute a program without main?
How many types of operators are there?
What is the primitive type byte?
What does jenkins do?
What are the different types of garbage collectors in java?
What are the differences between getting and load method?
What are the differences between graph and tree?
What is difference between checked and unchecked exception in java?
What are the steps that are followed when two computers connect through tcp?
can I implement my own start() method? : Java thread
From the two, which would be easier to write: synchronization code for ten threads or two threads?
What are design patterns and please explain?