can you create interface instance ?
Answer Posted / nishant
hi Uday,what you've done is, created an annonymous inner
class which is the implementer class of the interface.Here
the refernce variable is of the interface but it is
referencing to the newly created annonymous inner class
instance.
Here the instanceof operator returns true because
annonymous inner class is the implementer of interface and
instanceof always returns true with the same class or its
super class(try using instanceof with Object class, it will
always return true,may the object be of any class).
| Is This Answer Correct ? | 14 Yes | 0 No |
Post New Answer View All Answers
What are pass by reference and pass by value?
Is java hard to learn?
How do I get 64 bit java?
What do you mean by mnemonics?
What are the different conditional statements?
How do you sort data in java?
Is vector ordered in java?
How do you clear a method in java?
What are the types of methods in java?
Is java a digit method?
Can a class have a static inner class?
What do you mean by multithreaded program?
How many bytes is a url?
What is annotation in java?
What is the gregoriancalendar class in java programming?