小编Sec*_*ach的帖子

NotifyAll,IllegalMonitorStateException

import java.math.BigInteger;

class Numbers {

    final static int NUMBER = 2;
    final static int POWER = 4;

    static long msecs;
    static BigInteger result;
    static Boolean done = false;

    public static void main(String[] args) {

        BigInteger number = BigInteger.valueOf(NUMBER);
        result = number;

        //Boolean done = false;

        Runnable pow = () -> {
            System.out.println(number + " pow " + POWER + " = " + number.pow(POWER));

            synchronized (done) {
                done = true;
                done.notifyAll();
            }
        };

        Runnable sum = () -> {
            for(int …
Run Code Online (Sandbox Code Playgroud)

java multithreading exception notify

4
推荐指数
1
解决办法
645
查看次数

标签 统计

exception ×1

java ×1

multithreading ×1

notify ×1