Advertisement
Azazavr

com.javarush.test.level02.lesson05.task03

Jan 31st, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.93 KB | None | 0 0
  1. package com.javarush.test.level02.lesson05.task03;
  2.  
  3. /* У каждого животного должна быть хозяйка.
  4. Создайте объект типа Cat(кот), объект типа Dog (собака), объект типа Fish (рыбка) и объект типа Woman.
  5. Присвойте каждому животному владельца (owner).
  6. */
  7. public class Solution
  8. {
  9.     public static void main(String[] args)
  10.     {
  11.         Cat cat = new Cat();
  12.         Dog dog = new Dog();
  13.         Fish fish = new Fish();
  14.         Woman woman = new Woman();
  15.  
  16.         cat.owner = woman;
  17.         dog.owner = woman;
  18.         fish.owner = woman;
  19.     }
  20.  
  21.     public static class Cat
  22.     {
  23.         public Woman owner;
  24.     }
  25.  
  26.     public static class Dog
  27.     {
  28.         public Woman owner;
  29.     }
  30.  
  31.     public static class Fish
  32.     {
  33.         public Woman owner;
  34.     }
  35.  
  36.     public static class Woman
  37.     {
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement