Is java supports multiple inheritance? explain?
Answers were Sorted based on User's Feedback
Answer / payal
Java supports multiple inheritance via interface
Is This Answer Correct ? | 22 Yes | 2 No |
Answer / vivek dubey
NO java supports Multilevel Inheritance and
not the Multiple Inheritance
Multilevel Inheritance
class A{
}
class B extends A{
}
class c extends B{
}
Multiple Inheritance
class c extends A,B{ // nOt supported
}
Is This Answer Correct ? | 17 Yes | 0 No |
Answer / samuelj/samsjjj@gmail.com
java does not support Multiple inheritance so we can use
Interface
interface contains the abstract methods
Is This Answer Correct ? | 9 Yes | 0 No |
Answer / samuelj/samsjjj@gmail.com
java does not support inheritance so we can use Interface
interface contains the abstract methods
Is This Answer Correct ? | 9 Yes | 2 No |
Answer / vijayhukkeri@gmail.com
No. Java does't support multiple inheritance. It supports
only multilevel inheritance.Multiple inheritance is
possible in interfaces by using implements keyword.
ex: class a
{
----
}
class b extends a
{
----
}
class c extends a,b // this is not possible
ex2: class a
{
----
}
class b implements a
{
----
}
class c implements a,b // possible
{
---
}
Is This Answer Correct ? | 9 Yes | 4 No |
Answer / krishna kumar g.
Java doesn't supports Multiple Inheritence.
Let see the example.
class A
{
void m1()
{
// some code
}
}
class B
{
void m1()
{
// some code
}
}
class C extends A,B
{
void m2()
{ }
public static void main(String[] args)
{
C c=new C();
c.m1();
}
}
If we want to call m1() by using class C object, then
which class method(m1()) will be called.It is unable to
find the which class method(m1()) will be called.
So multiple Inheritence is not posssible.
Is This Answer Correct ? | 6 Yes | 1 No |
Answer / ravikiran
No not in a direct manner but interfaces serves the same
purpose
Is This Answer Correct ? | 4 Yes | 1 No |
Answer / dhawal
Instead of multiple inheritance there is feature called
interface in java.
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / anil singh(kushinagar)
No!. Java support multi_lable,single inheritence but not
multiple inheritence.
Is This Answer Correct ? | 2 Yes | 0 No |
What is constructor and virtual function?
abstract class Demo { public void show() { System.out.println("Hello I am In show method of Abstract class"); } } class Sample extends Demo { public void show() { super.show(); System.out.println("Hello I am In Sample "); } } public class Test { public static void main(String[] args) { //I WANT TO CALL THE METHOD OF BASE CLASS IT IS POSSIBLE OR NOT CAN WE USE SCOPE RESOLUTION OPERATOR TO CALL OR JAVA NOT SUPPORTED THAT :: OPERATORE } }
Why collection is called framework in java?
public class Test { public static void main(String[] args) { int countA = 0; int countB = 0; int countC = 0; int countD = 0; int countE = 0; int countF = 0; int countG = 0; int countH = 0; int countI = 0; int countJ = 0; int countK = 0; int countL = 0; int countM = 0; int countN = 0; int countO = 0; int countP = 0; int countQ = 0; int countR = 0; int countS = 0; int countT = 0; int countU = 0; int countV = 0; int countW = 0; int countX = 0; int countY = 0; int countZ = 0; } } Can anybody tell me any alternate solution(like loop or something) to automate this initialization process. Ex:- for(char chr='A';chr<='Z'; chr++) { (int) String "count"+chr = 0; }
What are the types of java?
How do you sort a list in java?
Why string is immutable with example?
Explain the difference between private, public, package and protected in java?
what is the difference between abstract class and Interface?where we can use it in realtime projects?
23 Answers Agile Software, Cognizant, IBM, Innodata, Logica CMG, Mitosis, Nagarro, Value Chain,
What's a method in programming?
Explain about the select method with an example?
Explain access specifiers?
0 Answers Thomson Reuters, Virtusa,