public class Cat {
//напишите тут ваш код
String name, address, color;
int wheght, age;
public void initialize(String name)
{
this.name = name;
}
public void initialize(String name, int wheght, int age)
{
this.name = name;
this.wheght = wheght;
this.age = age;
}
public void initialize(String name, int age)
{
this.name = name;
this.age = age;
this.wheght = 7;//стандартный вес
}
public void initialize(int wheght, String color)
{
this.wheght = wheght;
this.color = color;
this.name = null;
this.address = null;
this.age = null;
}
public void initialize(int wheght, String color, String address)
{
this.wheght = wheght;
this.color = color;
this.address = address;
}
incompatible types: <nulltype> cannot be converted to int:
Cat.java, line: 38, column: 20Илья
10 уровень
Как обычно сделал все правильно но ошибка. Не хочет принимать что int = null
Архивный
Комментарии (3)
- популярные
- новые
- старые
Для того, чтобы оставить комментарий Вы должны авторизоваться
ДмитрийЛ
13 января 2021, 21:18
Подскажите пожалуйста, почему мне недоступен этот квест? версия премиум.
0
Илья ГековMaster
14 августа 2018, 12:18решение
Может ли существовать кот без возраста?
И null нельзя присваивать примитивным типам.
И переменная веса написана с ошибкой.
+2
Илья
14 августа 2018, 13:27
спасибо, думаю понял)
0