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
Is there a way to increase the size of an array after its declaration?
Define how does a try statement determine which catch clause should be used to handle an exception?
Name few java.lang classes introduced with java 8 ?
What is a nested list?
What checkbox method allows you to tell if a checkbox is checked?
Where is singleton pattern used?
What does percent mean in java?
What if constructor is protected in java?
Compare overloading and overriding?
How do you pass by reference?
What an i/o filter?
What is multi-catch block in java?
What is a map in java?
What is static class
Write a java program to find the route that connects between Red and Green Cells. General Rules for traversal 1. You can traverse from one cell to another vertically, horizontally or diagonally. 2. You cannot traverse through Black cells. 3. There should be only one Red and Green cell and at least one of each should be present. Otherwise the array is invalid. 4. You cannot revisit a cell that you have already traversed. 5. The maze need not be in the same as given in the above example