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
Give a brief description of java socket programming?
In the below example, how many string objects are created?
Will minecraft java be discontinued?
What is mean by encoding?
Why java is object oriented?
There are two classes named classa and classb. Both classes are in the same package. Can a private member of classa can be accessed by an object of classb?
Why is java so popular?
How to make object serializable in java?
Can a class be private?
Can we declare main () method as non static?
How many bytes is a url?
What is a loop java?
Write a java program to check if a number is prime or not?
Does apple use java?
Why java is call by value?