Advertisement
jfcmacro

EjemploHilo4.java

Mar 27th, 2019
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.47 KB | None | 0 0
  1. class EjemploHilo4 implements Runnable {
  2.  
  3.     public void run() {
  4.     System.out.println("Esto es otro hilo: " + Thread.currentThread());
  5.     }
  6.  
  7.     public static void main(String []args) {
  8.     ThreadGroup tg = new ThreadGroup("fumador");
  9.     Thread eh3_1 = new Thread(tg, new EjemploHilo4(), "Ejemplo hilo 3 1");
  10.     Thread eh3_2 = new Thread(tg, new EjemploHilo4(), "Ejemplo hilo 3 2");
  11.  
  12.     eh3_1.start();
  13.     eh3_2.start();
  14.     System.out.println("Estos un hilo " + Thread.currentThread());
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement