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
How do you declare a variable?
In a program, initializing an array of 100 KB is throwing an out of memory exception while there is 100 MB of memory available. Why?
Differentiate between nested and inner class in java.
What is the different types of functions?
Can java hashmap have duplicate keys?
What is the program compilation process?
What is the purpose of format function?
what is the significance of listiterator in java?
What is a byte array?
Can we restart a dead thread in java?
Which number is denoted by leading 0x or 0x in java?
what is inner class in java?
Explain the selection sort algorithm?
What is unmodifiable list in java?
What is the final class modifier?