class MyThread extends Thread {

@Override
public void run() {
System.out.println("线程正在执行:" + Thread.currentThread().getName());
}
}

// 使用方式 MyThread thread = new MyThread(); thread.start();
public class Counter {
private int count = 0;
// 非线程安全的方法
public void increment() {
count++;
}
}