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

What is flush buffer?

515


Can you use abstract and final both with a method?

569


What is the static field modifier?

592


Define reflection.

571


What are keywords in programming?

558






How many types of interfaces are there?

570


How many types of flags are there?

519


How do you get the length of a string in java?

516


What is n in java?

535


Which is better singleton or static class?

501


What is difference between equals and hashcode method?

566


List primitive java types?

591


What is compareto () in java?

535


How do you declare an array in java?

512


Explain garbage collection in java?

538