package threads;
/**
*
* @author Nurhak
*/
public class Threads {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Worker w1=new Worker();
Worker w2=new Worker();
w1.start();
w2.start();
}
}
package threads;
/**
*
* @author Nurhak
*/
public class Worker extends Thread {
@Override
public void run() {
for (int i = 0; i < 10; i++) {
System.out.println(this.getName() + "-->" + i);
}
}
}
/**
*
* @author Nurhak
*/
public class Threads {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Worker w1=new Worker();
Worker w2=new Worker();
w1.start();
w2.start();
}
}
package threads;
/**
*
* @author Nurhak
*/
public class Worker extends Thread {
@Override
public void run() {
for (int i = 0; i < 10; i++) {
System.out.println(this.getName() + "-->" + i);
}
}
}
Comments
Post a Comment