when Can an object reference be cast to an interface reference?
Answer / praveen kumar
.An interface reference can point to any object of a class that implements this interface i.e. see the example below:
interface Foo{
void display();
}
public class TestFoo implements Foo{
void display(){
System.out.println(“Hello World”);
}
public static void main(String[] args){
Foo foo = new TestFoo();
foo.display();
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
What is setstring method in java?
What does @override mean in java?
What is a stream in java?
What is a java proxy?
What is ui framework in java?
How do I run a project in netbeans?
What is ibatis in java?
Is jar an executable?
What is flatmap in rxjs?
What does jpa mean?
Which instutute is offering course for rhino jain slee
How do you check if java is installed on windows command prompt?