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
Can we override private constructor in java?
Can an anonymous class be declared as implementing an interface and extending a class in java programming?
What is Session reduplication and how its done?
What is object-oriented paradigm?
Mention the default values of all the elements of an array defined as an instance variable.
List out five keywords related to exception handling ?
How to provide security in java
What is the difference between stringbuffer and stringbuilder class?
Why we use multi threading instead of multiprocessing?
Explain the difference between jvm and jre?
What is a treeset in java?
What is parsing a sentence?
What is type conversion in java?
What is runtime locatable code?
What is data type example?