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

Are arrays immutable in java?

765


How do you identify independent and dependent variables?

749


What are the advantages of autoboxing?

772


Which variable is the independent variable?

789


Do extraneous variables affect validity?

723


What is procedure overloading?

2042


Explain the usage of this with constructors?

771


What is public static?

767


What is exception handling in java?

819


Which is better arraylist or vector?

813


How do you compare characters in java?

745


What is the use of protected in java?

771


Which programming language is most secure?

757


Explain about anonymous inner classes in java?

812


Explain, java is compatible with all servers but not all browsers?

840