Does Java support multiple Inheritance?

Answer Posted / debapriya patra

Java does not support multiple inheritance.Why?

If anybody ask u why java does not support multiple
inveritance then answer is:"Whenever we create an instance
of a child class and we extend more then one class like
C++, then if these two classes contain same variable then
which will print if we try to print the variable."

Example:
class a
{
int i = 10;
}
class b
{
int i = 10;
}

class c extends a,b
{
public static void main(String[] args)
{
c c1 = new c();
System.out.printn(c1.i);//Here an ambiguous situation
will occur
}
}

Is This Answer Correct ?    29 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Difference between overriding and overloading in java?

582


What are data types in oop?

557


How can you add and remove nodes in jtree?

617


What is array and arraylist in java?

535


What is the difference between the size and capacity of a vector?

571






When we should use serialization?

572


What is a "pure virtual" member function?

600


What are facelets templates?

605


What is the use of coding?

526


Write a program to print 15 random numbers using foreach of java 8?

549


Which non-unicode letter characters may be used as the first character of an identifier?

602


Is java pass by value or pass by reference?

541


What is the function of compareto in java?

595


What is the difference between Error, defect,fault, failure and mistake?

665


Can I declare class as static or private?

547