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


Please Help Members By Posting Answers For Below Questions

Why java is considered dynamic?

741


Difference between Preemptive scheduling vs. Time slicing?

553


What are the 2 types of java programs?

554


What is ‘has a’’ relationship in java?

709


If a variable is declared as private, where may the variable be accessed?

537






Is arraylist dynamic in java?

507


Explain static nested classes ?

576


What is the purpose of the file class in java programming?

516


How to invoke external process in java.

551


What is anagram word?

509


What is a class variable?

551


Explain the importance of finalize() method.

552


Is string a data type in java?

576


What is the java project architecture?

1769


What is a parameter in a function?

517