I am trying to learn java. I need to write a program about car rental. I want to access variable whose value is given with constructor. I have written a code like below. It gives error on each line at 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);
}
}