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
Explain tree set and its features?
What is a lambda expression ? What's its use ?
Describe 2 different ways to concatenate two strings.
How do you pass by reference?
Is it safe to install java on my computer?
can java object be locked down for exclusive use by a given thread? : Java thread
Which are different kinds of source code?
Can we have two methods in a class with the same name?
what are three ways in which a thread can enter the waiting state? Or what are different ways in which a thread can enter the waiting state? : Java thread
What is the nested interface?
What is oop principle in java?
What is the most important feature of java? What is an interface?
How do you remove duplicates from an array in java?
Name four container classes.
What is preflight request?