public class MyThread implements Runnable {
private char n;
private int time;
private char i; public MyThread(char n, int time) {
this.n = n;
this.time = time;
} public void run() { if (n == '1') {
for (char i = 1; i <= 26; i++) {
try {
Thread.sleep(time);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.print(" " + i);
}
} else if (n == 'A') {
for (char i = 'A'; i <= 'Z'; i++) {
try {
Thread.sleep(time);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.print(" " + i);
}
} else {
for (char i = 'a'; i <= 'z'; i++) {
try {
Thread.sleep(time);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.print(" " + i);
}
} } public static void main(String[] args) { MyThread t1 = new MyThread('A', 1000);
Thread t = new Thread(t1);
t.start();
MyThread t2 = new MyThread('a', 2000);
Thread tt = new Thread(t2);
tt.start();
MyThread t3 = new MyThread('1', 3000);
Thread ttt = new Thread(t3);
ttt.start();
}
}