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

What does sprintf return?

588


Java is Pass by Value or Pass by Reference?

620


What is substring 1 in java?

591


What does flagged out mean?

574


What is the difference between super class & sub class?

564






Can we inherit a class with private constructor?

572


what is the difference between the methods sleep() and wait()? : Java thread

515


What is final class?

577


What is boolean false?

529


What is singleton pattern?

554


Explain about main() method in java ?

582


I want to persist data of objects for later use. What’s the best approach to do so?

500


What are user defined exceptions?

587


How do singleton patterns work?

516


Can we override compareto method?

503