Respuesta :
A class can have multiple subclasses, where each of the subclasses function independently. The extend keyword will be used to pass attributes from the Shape class to the Square and Circle subclasses
To answer this question, I will make the following assumptions
- The Shape class is already defined
- The area() method of the Shape class is also defined
- Lines that begin with // are comments, and these lines will be used to explain the code segment
//This creates the Square class
class Square extends Shape {
//The creates a constructor for width variable
Square(int length) { this.width = length; }
//This defines the area() method from the Square class
void area() {
//This calculates and prints the area of the square
System.out.print(Math.pow(width,2)); } }
//This creates the Circle class
class Circle extends Shape {
//The creates a constructor for width variable
Circle(int radius){ this.width = radius; }
//This defines the area() method from the Square class
void area(){
//This calculates and prints the area of the circle
System.out.println(Math.PI*Math.pow(width,2));
} }
Read more about abstract class at:
https://brainly.com/question/20261938