Advertisement
sergAccount

Untitled

Mar 21st, 2021
650
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 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.mycompany.app24;
  7.  
  8. /**
  9.  *
  10.  * @author Admin
  11.  */
  12. public class Main4 {
  13.     //
  14.     public static void main(String[] args) {
  15.        
  16.         // объект типа Counter - используется несколькими потоками
  17.         //Counter c = new Counter();
  18.         SynchronizedCounter c = new SynchronizedCounter();
  19.        
  20.         // объект типа Counter - используется несколькими потоками
  21.         Thread th1 = new Thread(new MyCounterTask(c));
  22.         Thread th2 = new Thread(new MyCounterTask(c));
  23.        
  24.         th1.start();
  25.         th2.start();
  26.        
  27.     }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement