Advertisement
Azazavr

javarush.test.level05.lesson05.task04

Oct 28th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.99 KB | None | 0 0
  1. package com.javarush.test.level05.lesson05.task04;
  2.  
  3. /* Создать три объекта типа Cat
  4. В методе main создать три объекта типа Cat и заполнить их данными.
  5. Использовать класс Cat из первой задачи. Класс Cat создавать не надо.
  6. */
  7.  
  8. public class Solution {
  9.     public static void main(String[] args) {
  10.         Cat cat1 = new Cat("Vaska", 1, 2, 3);
  11.         Cat cat2 = new Cat("Maska", 2, 2, 3);
  12.         Cat cat3 = new Cat("Borka", 4, 4, 4);
  13.     }
  14.  
  15.     public static class Cat {
  16.  
  17.         public static int count = 0;
  18.         private String name;
  19.         private int age;
  20.         private int weight;
  21.         private int strength;
  22.  
  23.         public Cat(String name, int age, int weight, int strength) {
  24.             count++;
  25.  
  26.             this.name = name;
  27.             this.age = age;
  28.             this.weight = weight;
  29.             this.strength = strength;
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement