all are saying java doesn't support multiple inheritance but
by default Object class is super class for all the user
defined classes and we can extend atmost one class so each
class can extend more than one class so java supports
multiple inheritance?i am confused with this,pls any one
explain me.
Answer Posted / amit singh
logic is simple differnet
imagine you create a class
Class A
{
A()
{
super()
}
}
ya this class extends Object class implicitly
and it will definitely call the Object class constructor
but if you extends the Class A explicitly
then what will happen
class A0
{
AO()
{
super();
}
}
class A extends AO
{
A()
{
super();
}
}
}
so what happen because the Object class Replace by this
immediate super class which is in your Apis which you build
in your project
now the class AO is responsible to implicit extends Object
class
so what is the mean that Object inheritence is passeddown
through your Immediate super class
so don't say that implicit inheritence creete the mulitiple
inherritence
"because in java is not allowed beacaus so ambiguity
when one class extends Two classes and both have same method
signature
then which method will call
Amit singh
amitsing2008@gmail.com
amit09mca
Is This Answer Correct ? | 13 Yes | 0 No |
Post New Answer View All Answers
How does arrays sort work in java?
Draw a UML class diagram for the code fragment given below: public class StringApplet extends Applet { private Label sampleString; private Button showTheString; private ButtonHandler bHandler; private FlowLayout layout; public StringApplet() { sampleString = new Label(" "); showTheString = new Button (" Show the String"); bHandler = new ButtonHandler(); layout = new FlowLayout(); showTheString.addActionListener(bHandler); setLayout(layout); add(sampleString); add(showTheString); } class ButtonHandler implements ActionListener { public void actionPerformed(ActionEvent e) { samplestring.setText("Good Morning"); } } } Note: The methods need not be indicated on the diagram.
What does arrays sort do in java?
If an object reference is set to null, will the garbage collector immediately free the memory held by that object?
Explain the difference between abstraction and encapsulation.
What is lambda expression in java?
how is final different from finally and finalize in java?
What is arraylist class in java?
What is functional interface in java?
Describe method overriding
Why are pointers not secure?
What is compareto () in java?
Is array primitive data type in java?
Does sprintf allocate memory?
What is return in java?