/
pandapo777
/
JavaStepik
Обзор
Документация
Войти
/
pandapo777
/
JavaStepik
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
OOP/src/examples/Monster.java
39 строк
638 B
pandapo777
Впереди коллекции (Ненавижу массивы!)
31 мар 2025, 23:23
31 мар 2025, 23:23
09ac563
Код
Авторство
О чём код?
package examples; public class Monster { int hands; int eyes; int legs; // int count; // String roar = "Grrrrrrrrr!"; Monster(int hands, int eyes, int legs) { this.hands = hands; this.eyes = eyes; this.legs = legs; } Monster(){ this(2); } Monster(int amount) { this(amount, amount, amount); } void voice(){ voice(1); } // void voice(int count, String roar){ int i; for(i = 0; i < count; i++){ System.out.println(roar); } } // void voice(int count){ voice(count, "Grrrrrrrrrrrrrr"); } }