can you create interface instance ?
Answer Posted / arnold schwarzenegger
Yes we can create an instance of Interface but not directly but by using its subclass. Just check the below code
interface check
{
public void method1();
}
abstract public class B implements check
{
public static void main(String[] args)
{
check c = new check()
{
public void method1()
{
System.out.println("interface B m2");
}
};
c.method1();
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are void methods?
What are the elements of java?
What is predicate in java?
What does 3 dots mean in java?
What is the generic class?
What is the main purpose of serialization in java?
What is jar?
What is wrapper class html?
What is bitwise complement?
What is the benefit of singleton pattern?
What is a "pure virtual" member function?
How many decimal digits is 64 bit?
What is final, finally, finalize?
What is a treeset class?
Is java 9 released?