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
Can you declare the main method as final?
What are streams?
What is linkedlist in java?
What is arrays aslist in java?
What is OOP Language?
Explain differences between checked and unchecked exceptions in java?
What is OOP's Terms with explanation?
How to obtain a performance profile of java program
Explain the hierarchy of java exception classes?
How do you execute a thread in java?
What are the different types of inheritance in java?
What is bom encoding?
Explain the reason behind ending a program with a system.exit(0)?
What is boolean example?
What are the new features in java 8? Explain