import java.util.Random;
class test1 extends Thread{
public void run() {
Random r = new Random();
for (int i = 1; i <= 100; i++) {
System.out.println("test1的第"+i+"个数:"+(r.nextInt(26)+1));
}
}
}
class test2 implements Runnable{
public void run() {
Random r = new Random();
for (int i = 1; i <= 100; i++) {
System.out.println("test2的第"+i+"个字母:"+(char)(r.nextInt(26)+65));
}
}
}
public class E {
public static void main(String[] args) {
test1 t1 = new test1();
test2 t2 = new test2();
Thread T = new Thread(t2);
t1.start();
T.start();
}
}
class test1 extends Thread{
public void run() {
Random r = new Random();
for (int i = 1; i <= 100; i++) {
System.out.println("test1的第"+i+"个数:"+(r.nextInt(26)+1));
}
}
}
class test2 implements Runnable{
public void run() {
Random r = new Random();
for (int i = 1; i <= 100; i++) {
System.out.println("test2的第"+i+"个字母:"+(char)(r.nextInt(26)+65));
}
}
}
public class E {
public static void main(String[] args) {
test1 t1 = new test1();
test2 t2 = new test2();
Thread T = new Thread(t2);
t1.start();
T.start();
}
}