TheBulgarianWolf

2 Threads

Feb 24th, 2020
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. public class RunThread extends Thread{
  2.  
  3.  
  4.     public RunThread(){
  5.  
  6.     }
  7.  
  8.     @Override
  9.     public void run() {
  10.         for(int i = 1;i<=20;i++){
  11.             System.out.print(i + " * ");
  12.             try {
  13.                 Thread.sleep(500);
  14.             }
  15.             catch(InterruptedException e){
  16.                 e.printStackTrace();
  17.             }
  18.         }
  19.  
  20.         for(int k = -20;k<=-1;k++){
  21.             System.out.println("<>"+k);
  22.             try {
  23.                 Thread.sleep(500);
  24.             }
  25.             catch(InterruptedException e){
  26.                 e.printStackTrace();
  27.             }
  28.         }
  29.     }
  30.  
  31.     public static void main(String[] args){
  32.         new RunThread().start();
  33.     }
  34. }
Add Comment
Please, Sign In to add comment