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 are the types of strings?
What isan abstract class and when do you use it?
explain the difference between jdk and jvm?
Is minecraft java edition free?
Can we split string with in java?
What is the difference between path and classpath variables?
How can we avoid including a header more than once?
What is fail fast in java?
What is identifier with example?
What is return used for in java?
Java Compiler is stored in JDK, JRE or JVM?
Can each java object keep track of all the threads that want to exclusively access it?
How is hashcode calculated in java?
What is the syntax and characteristics of a lambda expression?
What is difference between pointer and reference?