Hey guys I just wanted a quick reinsurance that this is correctly done:
So you have to find the error in the code segments -
Find the error in each of the following code segments:
//Superclass
public class Vehicle{
(member declarations…..)
}
//subclass
Public class car expands Vehicle{
(Member declarations….)
}
so isnt the error the fact its expands and should be extends instead correct??
3. //superclass
public class Vehicle{
private double cost;
public Vehicle(double c){
cost = c;
}
(Other methods……)
}
//subclass
public class Car extends Vehicle{
private int passengers;
public Car(int p){
passengers = c;
}
(Other methods…..)
}
Im not sure what the error is in this one, I got this wrong anyone have a clue??