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
Explain about sets?
What is complexity in java?
How do you pass by reference?
Considering notepad/ie or any other thing as process, what will happen if you start notepad or ie 3 times? Where 3 processes are started or 3 threads are started?
What 4 doubled?
What does a za z0 9 mean?
Is string a data type in java?
Why we used break and continue statement in java?
how can you take care of mutual exclusion using java threads? : Java thread
What does opcode mean?
What are the four integer types supported by java?
List the three steps for creating an object for a class?
What is object cloning in Java?
Describe the term diamond problem.
What carriage return means?