Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.javarush.test.level05.lesson12.home03;
- /* Создай классы Dog, Cat, Mouse
- Создай классы Dog, Cat, Mouse. Добавь по три поля в каждый класс, на твой выбор. Создай объекты для героев мультика Том и Джерри.
- Так много, как только вспомнишь.
- Пример:
- Mouse jerryMouse = new Mouse(“Jerry”, 12 , 5), где 12 - высота в см, 5 - длина хвоста в см.
- */
- public class Solution
- {
- public static void main(String[] args)
- {
- Mouse jerryMouse = new Mouse("Jerry", 12 , 5);
- Dog sparkyDog = new Dog("Sparky", 12, 10);
- Cat tomCat = new Cat("Tom", 5, 32);
- //Напишите тут ваш код
- }
- 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 strength;
- int height;
- public Dog(String name, int strength, int height)
- {
- this.name = name;
- this.strength = strength;
- this.height = height;
- }
- }
- public static class Cat
- {
- String name;
- int strength;
- int speed;
- public Cat(String name, int strength, int speed)
- {
- this.name = name;
- this.strength = strength;
- this.speed = speed;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement