Please enable JavaScript to use CodeHS

Want to receive Question of the Day updates? Subscribe Here

AP CSA Question of the Day Feb. 28, 2025

Reference
  1. Incorrect Correct No Answer was selected Invalid Answer

    The Rectangle class is defined as follows:

    public class Rectangle {
        private int width;
        private int height;
    
        public Rectangle(int width, int height) {
            this.width = width;
            this.height = height;
        }
    
        public int getWidth() {
            return width;
        }
    
        public int getHeight() {
            return height;
        }
    
        public int getArea() {
            return width * height;
        }
    }
    Java

    Which of the following properly defines a Square class that is a subclass of the Rectangle class? A Square is a Rectangle and has a width and height that happen to both be the same length.