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

What is difference between next () and nextline () in java?

546


What is java volatile?

553


What is ternary operator? Give an example.

611


What is method and methodology?

614


Where are local variables stored?

521






Does sprintf allocate memory?

606


Why can we not override static method?

603


What is the maximum size of byte array in java?

544


What is the difference between the final method and abstract method?

548


Differece between class and generic class?

572


What is a function in programming?

562


How do you take thread dump in java?

567


What is vector capacity in java?

607


What is the function of http?

542


What is final keyword in java?

560