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 do you understand by synchronization?
How many ways can an argument be passed to a subroutine and explain them?
Why should I use abstract class?
What is externalizable?
State one difference between a template class and class template.
Write a program in java to create a doubly linked list containing n nodes.
What is set string?
Differentiate jar and war files?
List types of storage classes in java?
What is difference between call by value and call by reference?
What are the advantages of java over C++?
How do you add spaces in java?
What is a lock or purpose of locks in java?
What is Major and importance difference between for and foreach loop ?
what is synchronization and why is it important? : Java thread