Under what circumstances an object reference be cast to an
interface reference?

Answers were Sorted based on User's Feedback



Under what circumstances an object reference be cast to an interface reference?..

Answer / 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

Under what circumstances an object reference be cast to an interface reference?..

Answer / janet

When the object implements the referenced interface, an
object reference be cast to an interface reference.

Is This Answer Correct ?    3 Yes 0 No

Under what circumstances an object reference be cast to an interface reference?..

Answer / debapriya maity

Exactly whenever ur entity passed the IS-A Test ,

A is B :)

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Core Java Interview Questions

I have an HashMap object, which has with key and value pair. It has 10 keys and values in that object. Now the question is I want insert new key and value in middle or any where in that list but not at the end or at the top. Is it possible or not. If yes how can we achieve this one?

2 Answers   Huawei,


What is the need to implement Serializable interface (with no methods) for objects which are to be serialized ? We can write our own functionality which writes objects to streams then why we need to implement and tell JVM that which objects can be serialized.

6 Answers   iFlex, Sapient,


Does string is thread-safe in java?

0 Answers  


What is the difference between synchronized and synchronized block?

0 Answers  


How is string stored in java?

0 Answers  


How do you execute a thread in java?

0 Answers  


Explain the significance of listiterator.

0 Answers  


Explain about version control?

0 Answers  


What are operators and its types?

0 Answers  


What do you mean by a JVM?

0 Answers   GE,


What is the difference between this() and super()?

15 Answers   TCS,


Is null function in java?

0 Answers  


Categories