发布网友 发布时间:2022-04-21 10:02
共1个回答
热心网友 时间:2023-11-09 12:27
但凡多翻下书。。。
ThreadA.java:
public class ThreadA extends Thread {
@Override
public void run() {
System.out.println("I am XXX");
}
}
ThreadB.java:
public class ThreadB extends Thread {
@Override
public void run() {
System.out.println("I love XXX");
}
}
Main.java:
public class Main {
public static void main(String[] args) {
ThreadA threadA = new ThreadA();
ThreadB threadB = new ThreadB();
threadA.start();
threadB.start();
}
}
运行结果: