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
What is primitive array?
How garbage collection is done in java?
How do you call a reference in java?
What steps are taken when the OS shifts from one-thread execution to another?
What is autoboxing in java?
What is the range of a character variable?
Which is best ide for java?
What is meant by local variable and instance variable?
What is final keyword?
What are the two environment variables that must be set in order to run any java programs?
What is the purpose of using java.lang.class class?
Which eclipse is best for java?
What is broken and continue statement?
What is module in project?
Explain about main() method in java ?