Can we instantiate Interfaces?

Answer Posted / paletipatisrinu

No we can instantiate interface directly.but we can create
instantiate of interface in directly

interface i1
{
public void wish();
}
public class A implements i1
{
public static void main(string...arg)
{
i1 o1=new A();
o1.wish();
}
public void wish()
{
System.out.println("we can create instantiate in directly");
}
}

Is This Answer Correct ?    17 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the indent key?

592


What is constructor in java ?

636


What is canonical name in java?

624


Define jre i.e. Java runtime environment?

576


What is the difference between Error, defect,fault, failure and mistake?

661






Why do we need variables?

531


What is a protected void?

506


How to retrieve data from database in java using arraylist?

530


Is a copy constructor?

578


What is the range of a character variable?

546


What is the purpose of using javap?

620


What is difference between float and double?

505


What is static synchronization?

577


What is ordered map in java?

541


Explain reverse a linked list recursive java solution?

533