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 to run a JAR file through command prompt?
What is method with example?
What do you mean by inner class in java?
What are static methods?
I want to control database connections in my program and want that only one thread should be able to make database connection at a time. How can I implement this logic?
How do you override a variable in java?
Which collection does not allow duplicates in java?
Which class contains a method: cloneable or object?
What is the difference between an argument and a parameter?
Can we use both this () and super () in a constructor?
What is the base class in java from which all classes are derived?
What do you mean by checked exceptions?
What are examples of modifiers?
Are arrays passed by reference in java?
What is finalize()? Is finalize() similar to a destructor?