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
In a container there are 5 components. I want to display the all the components names, how will you do that one?
What are the 6 boolean operators?
What is the locale class in java programming?
What access modifiers can be used for class ?
What is set in java?
Why we use set in java?
Is it compulsory for a try block to be followed by a catch block in java for exception handling?
What is a null point?
Explain the private field modifier?
Explain the different forms of polymorphism?
What is linked hashmap and its features?
If a variable is declared as private, where may the variable be accessed?
Tell me about your ability to work under pressure
What is use of set in java?
What super () does in java?