1
2 /**
3 * Hilo.java
4 * @author Luis Alejandro Bernal Romero (aztlek)
5 *
6 * Ejemplo de cómo crear hilos en java. Se puede ver como dos ciclos
7 * infinitos funcionan al mismo tiempo.
8 */
9
10 import java.io.*;
11
12 public class Hilo implements Runnable{
13
14 public static void main(String[] argv){
15 Hilo hilo = new Hilo();
16 Thread h = new Thread(hilo);
17 h.start();
18 for(;;){
19 System.out.println("Soy el padre");
20 }
21 }
22
23 public void run(){
24 for(;;){
25 System.out.println("Soy el hijo");
26 }
27 }
28 }
29
