Advertisement
jaVer404

level11.lesson08.task03

May 6th, 2015
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.03 KB | None | 0 0
  1. package com.javarush.test.level11.lesson08.task03;
  2.  
  3. /* Ничего не поменяешь
  4. Скрыть все внутренние переменные класса Cat, а также методы, позволяющие менять внутреннее состояние объектов класса Cat.
  5. */
  6.  
  7. public class Solution
  8. {
  9.     public static void main(String[] args)
  10.     {
  11.     }
  12.  
  13.     public class Cat
  14.     {
  15.         private String name;
  16.         private int age;
  17.         private int weight;
  18.  
  19.         public Cat(String name, int age, int weight)
  20.         {
  21.             this.name = name;
  22.             this.age = age;
  23.             this.weight = weight;
  24.         }
  25.  
  26.         public String getName()
  27.         {
  28.             return name;
  29.         }
  30.  
  31.         private void setName(String name)
  32.         {
  33.             this.name = name;
  34.         }
  35.  
  36.         public int getAge()
  37.         {
  38.             return age;
  39.         }
  40.  
  41.         private void setAge(int age)
  42.         {
  43.             this.age = age;
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement