Добавил:
Только когда поступишь в технический вуз поймешь на сколько ты гуманитарий Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
0
Добавлен:
15.02.2025
Размер:
943 б
Скачать
public class Car {
String model;
String license;
String color;
static int year;

public Car(String model, String license, String color, int year){
this.model = model;
this.license = license;
this.color = color;
this.year = year;
}
public Car(){
model = "car";
license = "";
color = "red";
year = 2020;
}
public Car(String color,int year){
this.color = color;
this.year = year;
}
public String toString(){
return "This a car, model " + model + " , license " + license + " color car" + color + " year" + year;
}
public void setColor(String color){
this.color = color;
}
public int getDiffYear(int currentYear){
return currentYear - this.year;
}
}
Соседние файлы в папке ПР-2