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?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is flatmap in rxjs?

930


How can c# app request minimum permissions? : java security

824


What about products that claim to block java applets at a firewall? : java security

932


What is map and flatmap?

1014


What is the java api?

904


What is transaction management in java?

895


When is static variable loaded? Is it at compile time or runtime? When exactly a static block is loaded in java?

936


What is meant by java se?

943


Explain the inheritance principle.

916


What are tlds in java?

862


How does java handle integer overflows and underflows?

1024


In hibernate what is the difference between the Session and SessionFactory?

935


What is a uint8?

962


What is http session in java?

986


What is a java proxy?

962