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

How do you do absolute value in java?

933


What is integer size in java?

953


How objects of a class are created if no constructor is defined in the class?

1024


What is a default constructor and also define copy contrucyor?

1053


I want to control database connections in my program and want that only one thread should be able to make database connection at a time. How can I implement this logic?

1052


What is arguments in java?

963


What lambda means?

947


can any body body expalin best definitions & best real time exaples for opps concepts.

2220


What is math in java?

1024


Explain tree set and its features?

1006


What is reflexive association?

1712


What is local class in java?

1032


How do you sort a string in alphabetical order in java?

875


What is the difference between preparedstatement and statement in java?

1068


When is the garbage collection used in Java?

1135