摘要:
一、模拟线程不安全场景。 public class MyRunnable implements Runnable { private int a = 100; //共享的数据 @Override public void run() { while (true) { if (a > 0) { //多个 阅读全文
摘要:
Thread类实现多线程。 一、创建多线程实现类。 public class MyThread extends Thread { //继承Thread类 public MyThread() { } public MyThread(String name) { //通过构造函数设置线程名称 super 阅读全文