did interface can implementation method ? i know its not
possible but my interviewer said its possible ..but how..?
any one have idea ???
Answer Posted / prabhu prasad
Hi Laxmidhar,
In your program you declare a reference variable, o1, of type interface A. Then you declare a new class that
has no name (means a anonymous class). Though A is an interface so the anonymous class actually implementing interface A…
If A is a class instead of interface then the anonymous class would be the subclass of A..
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the difference between a field variable and a local variable?
Can a class have an interface?
Is zero a natural number?
What is the difference between variable declaration and variable initialization?
When should I use singleton pattern?
Define immutable object?
What are examples of modifiers?
What is queue in java?
Why vector is used in java?
When should we create our own custom exception classes?
Howto get an object that will perform date & time calculations then format it for output in some different locales with different date style.can ne1 tel me the answer of this question.pls
What is the purpose of the wait(), notify(), and notifyall() methods in java programming?
what is the difference between thread and runnable types? : Java thread
What is Java Annotations?
What do you mean by collectors in java 8?