Перегрузка конструктора и методов Java Developer Android Studio Overloading Constructor and Method

Опубликовано: 22 Октябрь 2024
на канале: Grand Ckay
94
1

Overloading Constructor and Method
Java Developer Android Studio.
Перегрузка конструктора и методов


The task
Create a Monster class with fields: the number of eyes, legs and arms.
Create an empty constructor, and reload onto on the constructors with one
parameter, two and three. If values are not set in the constructor
parameters, then set = 2.
Create Methods
void monsterInfo() displays information about the monster,
overload the method - so that it returns a string and takes the
parameters of the eyes, legs and arms.
void voice () which displays the word "Voice". Overload to the
method with the parameter (int) displays "Voice" i times. And the
method with parameters (int i, String word) displays the word word - i times.


Перегрузка конструктора и методов
Задание
Создать класс Монстр с полями: количество глаз, ног и рук. Создать пустой
конструктор, и перегрузить на конструкторы с одним параметром, двумя и тремя.
Если в параметрах конструктора не установлены значения то установить = 2.
Создать методы
void monsterInfo() выводит информацию о монстре, перегрузить метод - чтоб
возвращал строку и принимал параметры глаз, ног и рук.
void voice() которое выводит слово "Голос". Перегрузить на метод с
параметром (int) выводит "Голос" i раз. И метод с параметрами
(int i, String word) выводит слово word - i раз.



Java Developer Android Studio.
Язык программирования Джава, Андроид Студио.


Repeat after me, then delete and write the code from memory. Create a new task and write the program yourself.
Повтори за мной, затем удали и напиши код по памяти. Придумай новое задание и напиши программу самостоятельно.

Thank you for watching
Спасибо за просмотр