can you create interface instance ?

Answer Posted / arun savoji

This expression instantiates a new object from an unnamed
(called anonymouns inner class)and previously undefined
class, which automatically implements the interface Test.
The class can explicitly implement one, and only one
interface, and cannot extend any class other than Object.

As it implement the Test interface so our anonymous inner
class has to implement the methods in this case we have to
implement wish() method.

In java we can not create instance of an interface, since
interface do not have contructor and as well as defalut
contructor.

Is This Answer Correct ?    9 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How does enum work in java?

548


What occurs when an object is constructed?

571


What is a package in java? List down various advantages of packages.

757


what is the constructor and how many types of constructors are used in java?

537


How many types of exception can occur in a java program?

538






What is n in java?

537


What is the difference between a field variable and a local variable?

573


Why java strings are immutable in nature?

591


What is the difference between double and float variables in java?

636


When can an object reference be cast to an interface reference in java programming?

582


Why do we need autoboxing in java?

519


Explain the features of interfaces in java?

558


Explain the difference between serializable and externalizable in java?

539


How many bytes is string in java?

610


Can we convert list to set in java?

512