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 is procedure writing?
Can you give few examples of final classes defined in java api?
What are encapsulation, inheritance and polymorphism?
What is the difference between stringbuffer and stringbuilder class?
How is java created?
How do you reverse a word in java?
What is a void method?
What is the main use of generics in java?
Can you tell me range of byte?
What is the technique adopted to create an immutable class?
Is a char always 1 byte?
Difference between serialization and deserialization in java?
Describe different states of a thread.
When do we use synchronized methods in java?
What is a Null object?