我正在努力学习java。我需要写一个关于租车的程序。我想访问其值由构造函数给出的变量。我编写了如下代码。它在main的每一行都给出了错误。
public class CarRental {
public int id;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Customer varCust = new Customer(1,"Joona","Lappeenranta");
Car varCar = new Car(1,"Mercedes",2013);
write(id);
}
public class Customer {
public Customer(int idCust, String Name, String Contact) {
id=idCust;
}
public class Car {
public Car (int idCar, String Model, int myear) {
}
}
public void writethat(int what) {
System.out.print(what);
}
}