public class Car { public String make; protected int weight; private String color; private Car(String make, int weight, String color) { this make = make; this weight = weight; this.color = color; }...


JAVA


public class Car<br>{<br>public String make;<br>protected int weight;<br>private String color;<br>private Car(String make, int weight, String color)<br>{<br>this make = make;<br>this weight = weight;<br>this.color = color;<br>}<br>public Car()<br>{<br>this(

Extracted text: public class Car { public String make; protected int weight; private String color; private Car(String make, int weight, String color) { this make = make; this weight = weight; this.color = color; } public Car() { this("unknown", -1, “white"); } public class ElectricCar extends Car { private int rechargeHour. public ElectricCar() { this(10); } private ElectricCar(int charge) { super(); rechargeHour = charge; }
In the following main(), identify the valid or invalid statements. If invalid, tell why.<br>public class TestMain<br>{<br>public static void main(String [] args)<br>{<br>Car myCarl, myCar2;<br>ElectricCar myElec1, myElec2;<br>myCarl = new Car( );<br>myCar2 = new Car(“Ford

Extracted text: In the following main(), identify the valid or invalid statements. If invalid, tell why. public class TestMain { public static void main(String [] args) { Car myCarl, myCar2; ElectricCar myElec1, myElec2; myCarl = new Car( ); myCar2 = new Car(“Ford", 1200, “Green"); myElec1 = new ElectricCar): myElec2 = new ElectricCar(15); } }

Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here