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

What is the use of an interface?

Answer Posted / ashokmail

By using interface you can do multiple inheritance in java.

Example :
interface student{
public void add();
}

public class clloge implements student{
public clloge(){
}
public void add(){
// Some codes
}
}

public class croom implements student{
public croom(){
}
public void add(){
// Some codes
}
}

Using Interface..
public void uinter {
private student[3] stu ;

public uinter(){
stu[0] = new croom();
stu[1] = new clloge()
stu[2] = new croom();
for(int i=0;i<3;i++)
stu[i].add();
}
}

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we override private constructor in java?

1032


Can an anonymous class be declared as implementing an interface and extending a class in java programming?

1362


What is Session reduplication and how its done?

2084


What is object-oriented paradigm?

1116


Mention the default values of all the elements of an array defined as an instance variable.

1036


List out five keywords related to exception handling ?

1059


How to provide security in java

2326


What is the difference between stringbuffer and stringbuilder class?

1157


Why we use multi threading instead of multiprocessing?

1123


Explain the difference between jvm and jre?

1076


What is a treeset in java?

1108


What is parsing a sentence?

1169


What is type conversion in java?

1093


What is runtime locatable code?

1498


What is data type example?

1005