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
What is collection class in java?
What is a 16 bit word?
What is final keyword in java? Give an example.
Differentiate between stringbuffer and string?
Is hashmap thread safe?
What is meant by object?
Which is better stringbuilder or stringbuffer?
What is square root in java?
Is java a utf 8 string?
How to perform quicksort in java?
What does %4d mean in java?
Can we declare the static variables and methods in an abstract class?
What are variable names?
Write a program in java to find the maximum and minimum value node from a circular linked list.
Can a static method be final?