PR1/settergetter/Locomotive.java~

32 lines
446 B
Java

public class Locomotive{
//instanzvariablen
private final int size;
private final int type;
private Car first;
//Konstruktor
public Locomotive(int s, int t, Car c) {
this.first = c;
this.size = s;
this.type = t;
}
//Methode
public void setFirst(Car newCar){
this.first = newCar;
}
public getFirst()
{return this.first}
public int getSize(){
return this.size;
}
public int getType(){
return this.type;
}
}