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 jdbc?
What is the use of lambda functions?
What is java ioc?
How common are security breaches? : java security
Why is lambda expression used?
What is the locale class?
What is a delimiter in java?
What is difference between map and flatmap in java 8?
What is the use of rs next () in java?
Why is class forname used in java?
Topic- looping,function overloading,nesting ,polymorphism. Aim - to write a function with a name buzz-buds,that will check whether the given numbers are buddies or not on the basis of no. of parameters passed during function calling.
What is map and flatmap?