Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


when Can an object reference be cast to an interface reference?



when Can an object reference be cast to an interface reference?..

Answer / praveen kumar

.An interface reference can point to any object of a class that implements this interface i.e. see the example below:

interface Foo{
void display();
}

public class TestFoo implements Foo{

void display(){
System.out.println(“Hello World”);
}

public static void main(String[] args){
Foo foo = new TestFoo();
foo.display();
}

}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Java Related AllOther Interview Questions

What is the content reside in Use case Document?

0 Answers  


what is the difference between Collaboration and Java Collaboration definition interms of JAVACAPS terminology?

1 Answers   CSC,


What is an api in java?

0 Answers  


What is the most important feature of java?

0 Answers  


What is native api in java?

0 Answers  


What if I do not provide the string array as the argument to the method?

0 Answers  


What is mdb in java?

0 Answers  


What is the difference between a jdk and a jvm?

0 Answers  


Where is java installed?

0 Answers  


Is lambda functional programming?

0 Answers  


What are microservices in java?

0 Answers  


Explain suspend() method under thread class>

0 Answers  


Categories