public class Solution {
public static void main(String[] args) {
Mouse jerryMouse = new Mouse("Jerry", 12, 5);
Dog dontknownamethedog = new Dog("Dontknow", 50 , 10);
Cat tomCat = new Cat("Tom", 40 , 15);
}
public static class Mouse {
String name;
int height;
int tail;
public Mouse(String name, int height, int tail) {
this.name = name;
this.height = height;
this.tail = tail;
}
}
public static class Dog {
String name;
int height;
int tail;
public Dog(String name, int height, int tail) {
this.name = name;
this.height = height;
this.tail = tail;
}
public static class Cat {
String name;
int height;
int tail;
public Cat(String name, int height, int tail) {
this.name = name;
this.height = height;
this.tail = tail;
}
}
}
}
//сделал двумя способами, но этот не идет, почему? (Пишет что cat не объявлен)
Nazar
9 уровень
Том и Джерри
Решен
Комментарии (2)
- популярные
- новые
- старые
Для того, чтобы оставить комментарий Вы должны авторизоваться
Alexander Seychas
7 февраля 2019, 06:58
Посмотри, где заканчивается class Dog. Скобки проверь.
0
Nazar
7 февраля 2019, 09:49
точно. спасибо
0