public class Vehicle {
        private int maxPassengers;
        public Vehicle()
        {
    maxPassengers=5;
        }
        public Vehicle(int x)
        {
    maxPassengers=x;
        }
        public int maxPassengers()
        {
    return maxPassengers;
        }
}
public class Motorcycle extends Vehicle {
    public Motorcycle()
    {
    super(2);
    } 
}

This code defines two classes: Vehicle and Motorcycle. IODJSHLKF

The Vehicle class has one private instance variable maxPassengers which stores the maximum number of passengers that the vehicle can carry. It has two constructors, one with no arguments which sets maxPassengers to 5, and another with an integer argument x which sets maxPassengers to the value of x. It also has a method called maxPassengers() which returns the value of maxPassengers.

The Motorcycle class is a subclass of Vehicle. It has a default constructor which calls the Vehicle class constructor with an argument of 2 using the super() method. This sets the maxPassengers variable to 2, which indicates that the motorcycle can carry a maximum of two passengers.

So, the Motorcycle class inherits the maxPassengers() method from the Vehicle class and sets the maxPassengers variable to 2 using the super() method.

//ex
public class School {
    protected String brand = "work";         //  attribute
    public void pencil() {                     // method
      System.out.println("write, write!");
    }
  }
  
  public class classwork extends School {
    private String modelName = "google doc";    // attribute
    public static void main(String[] args) {
    
    School mySchool = new School();
    // Call the pencil() method (from the School class) on the School object
    mySchool.pencil();
    // Display the value of the brand attribute (from the School class)
    System.out.println(mySchool.brand);

      // Create a new school object
    classwork myClasswork = new classwork();
      // Display the value of the brand attribute (from the Vehicle class) and the value of the modelName from the Car class
    System.out.println(myClasswork.modelName);
    }
  }

classwork.main(null);
write, write!
work
google doc

This code defines two classes: School and classwork.

The School class has an attribute brand that is a string with the value "work", and a method pencil() that prints "write, write!" to the console.

The classwork class extends the School class and has its own attribute modelName that is a string with the value "google doc". It also has a main() method which creates a School object and calls its pencil() method, and then displays the value of the brand attribute. Then, it creates a classwork object and displays the value of its modelName attribute.

Finally, the code executes the main() method of the classwork class by calling classwork.main(null), which runs the code in the main() method of classwork.