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 |
i have client interview in TCS.client is CITI BANK.how to face it,what type of questions they will ask,please tell send me to kumar525job@gmail.com
What is aop in java?
What is jpa implementation?
Is java Class Thread safe ???? How to make java Class Thread safe ??
What are all the documents have you involved in preparation of a Project as a Project Lead?
What is the means of java?
What is resultsetmetadata in java?
Write a program for the following topic - switch case,looping using fuction calling,nesting,console input output. Aim- to print a menu:- 1-series 2-single value. Each menu having sub menu armstrong or perfect.
What is meant by annotations in java?
In system.out.println(), what is system, out and println?
How do I install java on windows?
What is lambda value?