Java - Constructors
What will be the output of this Java code?
class Car {
String model;
int year;
Car(String m, int y) {
model = m;
year = y;
}
void display() {
System.out.println(model + " " + year);
}
}
public class Test {
public static void main(String[] args) {
Car c = new Car("Toyota", 2020);
c.display();
}
}