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 string :: npos?

583


Is upper case in java?

535


Is integer immutable in java?

552


How can you make sure that your singleton class will always return single instance in multi-threaded environment?

576


what is ststic with example

1599






What is polymorphism and what are the types of it?

513


Can we override constructors in java?

682


What data type is true or false?

579


How to store image in arraylist in java?

514


Can inner class final?

637


What class allows you to read objects directly from a stream?

876


Can we catch more than one exception in single catch block?

605


What are parameters in a method?

587


Is string a class?

559


What is a website container?

509