Can we instantiate Interfaces?

Answer Posted / anil pusuluri

One can't instantiate an interface. One can get a reference
to an interface.

Let's say Class A implements interface iA then we can't
instantiate IA
like IA a = new IA() -- this gives compilation error.

but we can get the referance to interface as below

IA a = new A()

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is hashset in java?

532


Can java program run without jre?

571


List implementations of list interface?

565


Why string is called as immutable?

524


How do you define a parameter?

584






What is the difference between the paint() and repaint() methods?

589


What is the latest java version?

562


What is the use of list in java?

525


Why are variables important in research?

557


What is the full form of jpeg?

525


Why are constructors used?

561


Explain the difference between association, aggregation and inheritance relationships.

558


What is an example of a keyword?

546


Can we have multiple catch block for a try block?

589


What is class level lock ?

612