Can we instantiate Interfaces?

Answer Posted / nagendra prasadu gandla

Yes you can instanciate but you have to implement the
methods of interface at the time of instanciation itself.

EX:
interface X
{
void abc();
}
class a
{
X z=new X(){void abc(){return;}};
}

Is This Answer Correct ?    5 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you know about the garbage collector?

616


What is update method called?

665


In a container there are 5 components. I want to display all the component names, how will you do that?

1562


What are the library functions in java?

550


What is native method in java?

568






What is scope & storage allocation of global and extern variables? Explain with an example

581


What is an argument java?

539


What is the difference between inner class and nested class?

553


Why there are some null interface in java? What does it mean?

644


What are the elements of java?

565


What do you mean by constant time complexity?

604


What is the difference between Array and Hash Table?

547


What is the purpose of a transient variable?

585


What is the use of hashmap in java?

557


What is singleton pattern?

557