Design and Implement an Inheritance and Method
overriding Model using following classes.
Create a base class named TwoDShapes. This class should have one
field length and one method called Area.
Create a subclass named Square ,that extends TwoDShapes and
calculates Area of the Square by overriding method called
Area.
Use the key word this for using the length field from super
class.
Create another sublclass Rectanagle extending TwoDShapes and
calculate area by overriding Area method.
Create another subclass Circle extending TwoDshapes and calculate
Area by overriding Area method.
Create a driver class that has a main method and create instances
of Square ,Rectangle and Circle classes. Display the area of all on
console using overridden area method.
coding language = java
If you have any doubts, please give me comment...
class TwoDShapes{
double length;
public void Area(){
System.out.println("From TwoDShapes class");
}
}
class Square extends TwoDShapes{
public void Area(){
System.out.println("Overridden area method from Square class");
}
}
class Rectangle extends TwoDShapes{
public void Area(){
System.out.println("Overridden area method from Rectangle class");
}
}
class Circle extends TwoDShapes{
public void Area(){
System.out.println("Overridden area method from Circle class");
}
}
public class TwoDShapesDriver{
public static void main(String[] args) {
TwoDShapes twoDShapes = new TwoDShapes();
Square square = new Square();
Rectangle rectangle = new Rectangle();
Circle circle = new Circle();
twoDShapes.Area();
square.Area();
rectangle.Area();
circle.Area();
}
}

Design and Implement an Inheritance and Method overriding Model using following classes. Create a base class...