Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.javarush.test.level05.lesson05.task04;
- /* Создать три объекта типа Cat
- В методе main создать три объекта типа Cat и заполнить их данными.
- Использовать класс Cat из первой задачи. Класс Cat создавать не надо.
- */
- public class Solution {
- public static void main(String[] args) {
- Cat cat1 = new Cat("Vaska", 1, 2, 3);
- Cat cat2 = new Cat("Maska", 2, 2, 3);
- Cat cat3 = new Cat("Borka", 4, 4, 4);
- }
- public static class Cat {
- public static int count = 0;
- private String name;
- private int age;
- private int weight;
- private int strength;
- public Cat(String name, int age, int weight, int strength) {
- count++;
- this.name = name;
- this.age = age;
- this.weight = weight;
- this.strength = strength;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement