can you create interface instance ?
Answer Posted / shankar patil
You can't create an object without method implementations.
Anonymous inner classes allow you to do.
public interface MyInterface {
public void myMethod() ;
}
MyInterface myIntfObj = new MyInterface() {
public void myMethod() {
}
};
myIntfObj.myMethod();
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Is string serializable in java?
What is t in generics in java?
What does a boolean method return?
How big is a gigabyte?
Can a constructor be made final?
Is null or empty java?
Can we modify the throws clause of the superclass method while overriding it in the subclass?
I want to print “hello” even before main is executed. How will you acheive that?
What is the difference between the size and capacity of a vector?
What is the flag in java?
Why are the methods of the math class static?
What is the difference between form & report?
Why super is first line in java?
Is a string literal?
How do you create an array in java?