写两个线程,交替打印数字和字母,一个线程打印 1~26,另一个线程打印字母 A-Z
1.使用synchronized public static void main(String[] args) { new Thread(new MyThread(),"p1").start(); new Thread(new MyThread(),"p2").start(); }static class MyThread implements Runnable{ public MyThread() { super();
原创
2020-07-05 13:21:05 ·
1802 阅读 ·
0 评论