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 a class in java?

578


what is anonymous class in java?

540


Does string is thread-safe in java?

587


Does collectionutils isempty check for null?

807


How is the marker interface used in Java?

606






Why synchronization is important in java?

558


What is the main purpose of serialization in java?

525


What is the use of singleton?

508


what is the purpose of the runtime class?

551


What is runtime polymorphism or dynamic method dispatch?

521


What is a instance variable in java?

544


Can we increase size of array?

562


What does java edition mean?

528


What is appletviewer?

564


When should we create our own custom exception classes?

581