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


Please Help Members By Posting Answers For Below Questions

Will the compiler creates a default constructor if I have a parameterized constructor in the class?

821


What is a values collection view ?

880


Name few java util classes introduced with java 8 ?

721


Why is it called a string?

760


Is treeset sorted in java?

777


Define reflection.

757


What is pass by value?

717


What is a parameter in simple terms?

763


What is stringreader?

713


What does replaceall do in java?

701


How can you say java is object oriented?

835


Why java is not 100% object-oriented?

1202


What does compareto () do in java?

788


Define packages in java?

792


What is method reference?

734