多线程问题
Posted kuoat
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了多线程问题相关的知识,希望对你有一定的参考价值。
public class ReadSku extends Logger{ static class Num implements Runnable{ public int a = 0; @Override public void run() { synchronized (Num.class){ for (int i = 0; i < 10; i++) { System.out.println(Thread.currentThread().getName()+"========"+a++); } } } } protected ReadSku(String name) { super(name); } static Logger logger = Logger.getLogger(ReadSku.class); public static void main(String[] args) throws IOException { // HashMap map = new HashMap<>(); // getprice();//单个遍历表信息 Num num1 = new Num(); Num num2 = new Num(); Num num3 = new Num(); Thread thread1 = new Thread(num1); Thread thread2 = new Thread(num2); Thread thread3 = new Thread(num3); thread1.start(); thread2.start(); // thread3.start(); }
以上是关于多线程问题的主要内容,如果未能解决你的问题,请参考以下文章