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

Under what conditions is an object’s finalize() method invoked by the garbage collector?

978


How do you start a new line in java?

924


Is stringwriter thread safe?

939


What is the epoch date?

952


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

1017


Why we do exception handling in java and how many types of exceptions are there?

1044


When we should use serialization?

964


Discuss different types of errors that generally occur while programming.

981


What is xslt in java?

934


What’s the difference between constructors and other methods?

933


How is a structure different from array ?

992


Can a lock be acquired on a class in java programming?

924


How will you reverse a singly-link list?

938


Is double bigger than float?

912


Can we print null in java?

998