小编use*_*712的帖子

wait() 和 notifyAll() 方法不是静态的

public synchronized  static int get() {
    while(cheia()==false){
        try{
            wait();
          }
        catch(InterruptedException e){
        }
    }

    if (fila[inicio] != 0) {
        int retornaValor = fila[inicio];
        fila[inicio] = 0;
        inicio++;
        if (inicio == size) {
            inicio = 0;
        }
        notifyAll();
        return retornaValor;
    }
    notifyAll();
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

为什么wait()和notifyAll()在这段代码中没有运行?

IDE 说: wait() 方法(或 notifyAll)不是静态的?

你能帮助我吗?

java multithreading producer-consumer notify wait

3
推荐指数
1
解决办法
1万
查看次数

如何读取c中用":"分隔的两个字符串

我需要知道如何读取字符串并分成两部分,如下例所示.

我在@amanda文件中有这个字符串:@bruna,但我不能读作单独的单词,而且每个商店都有两个不同的变量,如下所示:

char userA[20];
char userB[20];
scanf("%s:%s", userA, userB);
Run Code Online (Sandbox Code Playgroud)

你能帮助我吗?

c string file scanf

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

标签 统计

c ×1

file ×1

java ×1

multithreading ×1

notify ×1

producer-consumer ×1

scanf ×1

string ×1

wait ×1