public class Users {
public static void main(String[] args) {
AppleA a = new AppleA();
AppleB b = new AppleB();
a.start();
b.start();
}
}
class AppleA extends Thread {
public void run() {
for (int i = 0; i < 5; i++) {
System.out.println("AppleA " + i);
}
System.out.println("Exit AppleA");
}
}
class AppleB extends Thread {
public void run() {
for (int i = 0; i < 5; i++) {
System.out.println("ClassB " + i);
}
System.out.println("Exit B");
}
}
Output:
0 comments:
Post a Comment