I started my java class not long ago.
I`m just creating a class car, and I`m not sure how to call a function with a return type in main, can anybody help me.
this is what I have:
class TestCar
{
public static void main(String[] args)
{
Car myCar = new Car();
myCar.numDoors = 4;
myCar.numPassengers = 4;
myCar.maxSpeed = 65;
System.out.println("This is a car with 4 doors, it has three passengers and the driver.");
System.out.println(myCar.reverse());
}
}
I have a class Car with numDoors, numPassengers, maxSpeed as integers.
and then a few functions returning void, one of them is: void reverse(int units) it returns nothing but takes units, when I call it in main I get an error, I think I`m not calling it properly.