Under what circumstances an object reference be cast to an
interface reference?
Answer Posted / muthusenthil
when a class implements an interface then an object
referance of that class can be casted to interface referance
class A implements B{
public static void main(String args[]){
B b=new A();
}
| Is This Answer Correct ? | 6 Yes | 1 No |
Post New Answer View All Answers
How can we break singleton in java?
How to access arraylist elements in java?
What is the purpose of the finally clause of a try-catch-finally statement in java programming?
What is fail first in java?
Is break statement can be used as labels in java?
What is constructor chaining and how is it achieved in java?
What is the purpose of final keyword and when to use it?
Can we extend singleton class?
How to stop a thread in java? Explain about sleep () method in a thread?
Should you use singleton pattern?
How is garbage collection controlled?
How do you sort data in java?
Can we pass a primitive type by reference in java? How
What is the program compilation process?
What is the difference between integer parseint and integer valueof?