Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ut2_P3;
- public class HiloInterrupt extends Thread {
- public int c;
- public HiloInterrupt(int c) {
- this.c = c;
- }
- public void run() {
- while (!isInterrupted()) {
- for (int i = 0; i < 5; i++) {
- System.out.println("Hilo " + c + " línea " + i);
- }
- }
- }
- }
- package ut2_P3;
- public class PruebaInterrupt {
- public static void main(String[] args) {
- for (int i = 0; i < 5; i++) {
- HiloInterrupt a;
- a = new HiloInterrupt(i + 1);
- a.start();
- if(a==i){
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement