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...

Any one can explain how the inerface uses in java. give with
example.

Answer Posted / yogesh sanas

Interface is a contract between class and interface. Interface has some public abstract methods which class needs to be implement.

We can achieve polymorphism using Interface.

e.g.
Interface Interface_Name(){
int add(int x, int y);
}

Class MyClass implements Interface_Name{
public int add(int x, int y){
return x+y;
}
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What interface is extended by awt event listeners?

1101


Explain about interthread communication and how it takes place in java?

1071


What is the exact difference in between Unicast and Multicast object?

2189


What is static in java?

1156


Can we force the garbage collection to run?

1000


What is == mean?

1039


Write java program to reverse string without using api?

1103


What is are packages?

1083


How do I convert a string to an int in java?

1117


What is byte [] in java?

1066


Are global variables initialized to zero?

997


What are different types of arrays?

1052


What is a flag value?

1097


Explain different forms of polymorphism?

1191


How do you use compareto?

986