Consider the following class definitions. Identify invalid statements.
class Car {
public String make;
protected int weight;
private String color;
...
}
class ElectricCar extends Car {
private int rechargeHour;
public ElectricCar() {
...
}
//copy constructor
public ElectricCar (ElectricCar car) {
this.make = car.make;
this.weight = car.weight;
this.color = new String(car.color);
this.rechargeHour= car.rechargeHour;
}
...
}
class TestMain {
public static void main (String[] args) {
Car myCar;
ElectricCar myElecCar;
myCar = new Car();
myCar.make = "Chevy";
myCar.weight = 1000;
myCar.color = "Red";
myElecCar = new ElectricCar();
myCar.make = "Chevy";
myCar.weight = 500;
myCar.color = "Silver";
}
}
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.