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

Can a method be static and synchronized?

1103


What is meant by rest api in java?

994


What is jpa entitymanager?

1005


what is reflection api? How are they implemented?

1076


what about jdb and javadoc by example ?

2181


can anyone tell me what kind of questions are asked for core java exam in aptech

1915


How do javabeans work?

925


What is serializable in java?

895


What does persist mean in java?

1042


I am trying to create a new universal user group. Why can't i? : java security

965


What is csrf in java?

1021


Why is javac not recognized?

939


Explain issues of old java date api?

1057


Are there tuples in java?

1000


What is an api in java?

1120