Académique Documents
Professionnel Documents
Culture Documents
CLASE HILO
FORMA 2
FORMA 3
/**
* @param args the command line
arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int i;
NoThread hilo=new NoThread();
hilo.start();
for (i=1;i<=20;i++)
System.out.print ("SI ");
}
}
public class NoThread extends Thread{
public void run(){
int i;
for(i=1;i<=20;i++){
System.out.print("NO ");
}
}
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int i;
NoThread claseRunnable=new NoThread();
Thread hilo=new Thread(claseRunnable);
hilo.start();
for (i=1;i<=20;i++)
System.out.print ("SI ");
}
}
public class NoThread implements Runnable{
public void run(){
int i;
for(i=1;i<=20;i++){
System.out.print("NO ");
}
}
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int i;
NoThread hilo=new NoThread();
hilo.start();
for (i=1;i<=20;i++)
System.out.print ("SI ");
}