Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.javarush.test.level11.lesson08.task02;
- /* Доступ есть
- Скрыть все внутренние переменные класса Cat, но только те, к которым остается доступ с помощью методов.
- */
- public class Solution
- {
- public static void main(String[] args)
- {
- }
- public class Cat
- {
- private String name;
- private int age;
- public int weight;
- public Cat(String name, int age, int weight)
- {
- this.name = name;
- this.age = age;
- this.weight = weight;
- }
- public String getName()
- {
- return name;
- }
- public void setName(String name)
- {
- this.name = name;
- }
- public int getAge()
- {
- return age;
- }
- public void setAge(int age)
- {
- this.age = age;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement