sergAccount

Untitled

Aug 30th, 2020
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.14 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package com;
  7.  
  8. import com.spec.Employee;
  9. import com.spec.SingleObject;
  10.  
  11. /**
  12.  *
  13.  * @author Admin
  14.  */
  15. public class Main {
  16.    
  17.     //
  18.     public static void main(String[] args) {
  19.        
  20.         //SingleObject o = new SingleObject();
  21.         SingleObject object = SingleObject.getInstance();
  22.         object.showMessage();
  23.         //
  24.         SingleObject.getInstance().showMessage();
  25.        
  26.         // сотрудник
  27.         Employee e = new Employee("Test1", "Dep1", 100);
  28.         // подчиненные данного сотрудника
  29.         Employee e1 = new Employee("Test2", "Dep1", 200);
  30.         Employee e2 = new Employee("Test3", "Dep1", 300);
  31.         //
  32.         e.add(e1);
  33.         e.add(e2);
  34.         //
  35.         System.out.println("Сотрудник e=" + e.getName());
  36.         for(Employee eObject: e.getSubordinates()){
  37.             System.out.println("eObject.name=" + eObject.getName());
  38.         }
  39.     }    
  40. }
  41.  
Add Comment
Please, Sign In to add comment