I understand what abstract classes are used for. From what I know, in abstract classes you create a method but leave it blank. Then you have a subclass that will override that method and create it's own implimentation.
For school I have an abstract class project that I'm currently working on but I am stuck.
Abstract class code:
public abstract class Bike
{
private String brand;
public Bike(String bikeBrand)
{
brand = bikeBrand;
}
public String getBrand()
{
return brand;
}
public String setBrand(String newBrand)
{
brand = newBrand;
return newBrand;
}
public abstract int motorSize();
public String toString()
{
return "The bike is a " + brand + ".";
}
}
subclass code:
public class Honda extends Bike
{
private int numOfWheels;
private int year;
public Honda(int wheels, int yr)
{
numOfWheels = wheels;
year = yr;
}
public int motorSize()
{
}
}
Abstract class compiles, but the Honda class will not.
"Constructor Bike in class Bike cannot be applied to given types.
If someone could help me with this problem or even link me to a video that explains this well that would be greatly appreciated.