Advertisement
sergAccount

Untitled

Jan 30th, 2021
849
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 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.app5;
  7.  
  8. import java.util.logging.Level;
  9. import java.util.logging.Logger;
  10.  
  11. /**
  12.  *
  13.  * @author Admin
  14.  */
  15. public class MyTask implements Runnable{
  16.  
  17.     @Override
  18.     public void run() {
  19.         //
  20.         System.out.println("MyTask");
  21.         for (int i = 0; i < 10; i++) {            
  22.             System.out.println("MyTask.i=" + i);
  23.             try {
  24.                 Thread.sleep(1000);
  25.             } catch (InterruptedException ex) {                
  26.                ex.printStackTrace();
  27.                 System.out.println("exception in MyTask!");
  28.                 return;
  29.             }
  30.         }        
  31.     }    
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement