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

What is collection class in java?

986


What is a 16 bit word?

980


What is final keyword in java? Give an example.

1000


Differentiate between stringbuffer and string?

1017


Is hashmap thread safe?

969


What is meant by object?

994


Which is better stringbuilder or stringbuffer?

917


What is square root in java?

1086


Is java a utf 8 string?

962


How to perform quicksort in java?

1090


What does %4d mean in java?

1463


Can we declare the static variables and methods in an abstract class?

977


What are variable names?

955


Write a program in java to find the maximum and minimum value node from a circular linked list.

1060


Can a static method be final?

1040