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

What does math floor () do?

565


Why heap memory is called heap?

600


What is type inference in java8?

590


how to create multithreaded program? Explain different ways of using thread? : Java thread

541


Difference between collection, collection and collections in java?

575






Mention a package that is used for linked list class in java.

535


What is complexity in java?

537


what is nested class in java?

611


Can we extend singleton class in java?

557


When is the finalize() called?

714


What is the default access specifier for variables and methods of a class?

576


Given a singly linked list, find the middle of the list in a single traversal without using temporary variable.

619


Can we initialize the final blank variable?

598


Is singleton thread safe in java?

558


Explain the difference between a Thread and a Process.

574