I am new to programming and cannot figure out how to create a new object using a 2-argument constructor. I'm just going to copy/paste code out of the program that is relevant.
This is my class:
public class Car {
private int yearModel;
private String make;
private static int speed;
public Car (int yM, String m)
{
yearModel = yM;
make = m;
speed = 0;
}
This is my test class:
public class TestCar {
private static String Honda;
public static void main(String[] args)
{
Car c1 = new Car(1999, Honda);
I couldn't run the program without adding "private static String Honda;
".
When I run it I get Null
for Honda
.