Complete the code to declare a parameterized constructor for the class.
public class Car { String model; int year; public [1](String model, int year) { this.model = model; this.year = year; } }
Complete the code to create an object of the class using the parameterized constructor.
Car myCar = new [1]("Toyota", 2020);
Fix the error in the constructor declaration.
public class Book { String title; int pages; public [1](String title, int pages) { this.title = title; this.pages = pages; } }
Fill both blanks to complete the parameterized constructor and assign values.
public class Student { String name; int age; public [1](String name, int age) { this.[2] = name; this.age = age; } }
Fill all three blanks to complete the class with a parameterized constructor and create an object.
public class Laptop { String brand; int ram; public [1](String brand, int ram) { this.brand = [2]; this.ram = ram; } public static void main(String[] args) { Laptop myLaptop = new [3]("Dell", 16); } }
