can you create interface instance ?

Answer Posted / anthony

cool buddy. Nice way to fool people.

If you really need to check the concept, put the code in
eclipse or netbeans and see. The method in the anonymous
class would show as overriden from interface Test and if
you remove the method from the anonymous class, it would
not compile. So at the end you are having an instance of
class implementing the interface.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the differences between heap and stack memory in java?

524


Explain the importance of throwable class and its methods?

558


What is immutable class in java?

506


Which java version is latest?

527


How to create com object in Java?

638






What is the difference between replace and replace all?

462


What is set in java?

520


Why java is not 100% object-oriented?

815


Are variables stored in ram?

545


Can we declare an interface as final?

559


How to add menushortcut to menu item?

557


What is a singleton class in Java?

501


What is the reason behind using constructors and destructors?

545


What is the independent variable in an experiment?

538


What is treeset in java?

529