Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1. package ut2_P3;
  2.  
  3. public class HiloInterrupt extends Thread {
  4.  
  5.     public int c;
  6.  
  7.     public HiloInterrupt(int c) {
  8.         this.c = c;
  9.     }
  10.  
  11.     public void run() {
  12.         while (!isInterrupted()) {
  13.  
  14.             for (int i = 0; i < 5; i++) {
  15.                 System.out.println("Hilo " + c + " línea " + i);
  16.             }
  17.  
  18.         }
  19.  
  20.     }
  21. }
  22.  
  23.  
  24.  
  25. package ut2_P3;
  26.  
  27. public class PruebaInterrupt {
  28.  
  29.     public static void main(String[] args) {
  30.  
  31.         for (int i = 0; i < 5; i++) {
  32.             HiloInterrupt a;
  33.             a = new HiloInterrupt(i + 1);
  34.             a.start();
  35.             if(a==i){
  36.                
  37.             }
  38.         }
  39.  
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement