can you create interface instance ?

Answer Posted / naresh jangili

no we can't create an object to interface and also abstract because two classes are un implememnted class for every un implemented classes we can create only reference varable.
but for every implemented classes we can create objects.
eg: interface A{
public void test()
}
class B implementes A
{
public void test()
{
s.o.p("hello");
}
public static void main(String argss[])
{
B b=new B(); (object creation)
A a1=null; (reference variable)

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between checked exception and unchecked exception?

516


What is the purpose of static keyword in java?

509


What does += mean coding?

503


What is the structure of java?

500


What happens when main () method is declared as private?

643






What is difference between fail-fast and fail-safe?

580


What is preparedstatement in java?

549


Which is faster string or stringbuilder?

507


What are the differences between processes and threads?

503


What are the types of relation?

561


What will be the initial value of an object reference which is defined as an instance variable?

627


What is maximum size of arraylist in java?

483


How can you traverse a linked list in java?

670


What is derived datatype?

619


How do you find the independent variable?

502