Answer Posted / divyesh chauhan
yes java do not support multiple inheritance but we can achieve multiple inheritance using concept of interface implementation in class
for e:g
interface my
{
public void show();
}
interface my1 extends my
{
void disp();
}
class child implements my1
{
public void show()
{
System.out.println("hello java");
}
public void disp()
{
System.out.println("hello disp");
}
public static void main(String...a)
{
my m1=new child();
m1.disp();
m1.show();
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is tcp and udp?
What is off heap memory?
Can string be considered as a keyword?
What is a method in coding?
What are the drawbacks of singleton class?
Can we declare a constructor as final?
Howto get an object that will perform date & time calculations then format it for output in some different locales with different date style.can ne1 tel me the answer of this question.pls
What is the importance of hashcode() and equals() methods?
Explain the difference between transient and volatile in java?
Can we have multiple public classes in a java source file?
Does unicode support all languages?
What is the use of beaninfo?
What’s meant by anonymous class?
What is java basic concept?
Can we have more than one package statement in source file ?