题目描述
文章来源:https://www.toymoban.com/news/detail-608311.html
解析:文章来源地址https://www.toymoban.com/news/detail-608311.html
class Foo {
public int a = 0;
public Foo() {
}
public void first(Runnable printFirst) throws InterruptedException {
// printFirst.run() outputs "first". Do not change or remove this line.
printFirst.run();
a++;
}
public void second(Runnable printSecond) throws InterruptedException {
while(true){
if(a == 1){
printSecond.run();
a++;
break;
}else{
Thread.yield();
}
}
// printSecond.run() outputs "second". Do not change or remove this line.
}
public void third(Runnable printThird) throws InterruptedException {
while(true){
if(a == 2){
printThird.run();
break;
}else{
Thread.yield();
}
}
// printThird.run() outputs "third". Do not change or remove this line.
}
}
到了这里,关于力扣1114.按序打印-----题目解析的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!