Advertisement
sergAccount

Untitled

Mar 21st, 2021
630
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 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 MyTask3 implements Runnable {
  13.  
  14.     @Override
  15.     public void run() {
  16.         //
  17.         System.out.println("MyTask3.run>>");
  18.         int i = 0;
  19.         boolean v = true;
  20.         while(v){
  21.             System.out.println("i=" + (i++));
  22.             // проверка на то что поток был прерван
  23.             if(Thread.interrupted()){
  24.                 break;
  25.             }
  26.         }        
  27.         System.out.println("<<");
  28.     }        
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement