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

Can we override compareto method?

944


Is java 9 released?

991


When do you get classcastexception?

1026


What happens when you add a double value to a string?

981


Explain when noclassdeffounderror will be raised ?

1039


List the interfaces which extends collection interface?

937


What is finalize method?

1102


Is simpledateformat safe to use in the multithreaded program?

991


What does math floor () do?

958


How to convert string to char and vice versa?

990


What is arrays sort in java?

955


What are methods?

1016


What is string pooling concept?

1057


Can a abstract class be declared final?

988


Is a boolean 1 bit?

1055