Lets us take instances of two classes
public abstract class Shapes
{
public abstract void draw(Graphics g);
}
public class Rectangle extends Shapes
{
public void draw(Graphics g)
{
//implementation of the method
}
}
Here the class Rectangle has extended class Shapes and implicitly it extends class Object. I know no other extension is possible, but can't we call inherited classes Shapes and Object multiple inheritance? (Since inheriting two classes is multiple inheritance from one perspective)
public class Rectangle extends Shape, Point, Dimension- which Java obviously can't do.Objectinheritance is fromShapesextendingObject. (Every class, exceptObject, inherits from exactly one base class. If you don't specify the base class, it defaults toObject.) If there's a difference betweenShapesandObject,Rectanglewill always see theShapesversion.