when Can an object reference be cast to an interface reference?
Answer Posted / 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 |
Post New Answer View All Answers
What is flatmap in rxjs?
How can c# app request minimum permissions? : java security
What about products that claim to block java applets at a firewall? : java security
What is map and flatmap?
What is the java api?
What is transaction management in java?
When is static variable loaded? Is it at compile time or runtime? When exactly a static block is loaded in java?
What is meant by java se?
Explain the inheritance principle.
What are tlds in java?
How does java handle integer overflows and underflows?
In hibernate what is the difference between the Session and SessionFactory?
What is a uint8?
What is http session in java?
What is a java proxy?