i
我遇到致命错误:调用未定义的方法Smarty :: Smarty()
我在php项目文件夹中使用了Smarty软件
但是我出错了
我第一次在php中使用此Smarty软件
我没明白这段代码的线索
答案 0 :(得分:1)
要调用父级构造函数,您必须使用
public class PrintOddEvenByTwoThreads {
static int number = 1;
static Thread odd;
static Thread even;
static int max = 10;
static class OddThread extends Thread {
@Override
public void run() {
while (number <= max) {
if (number % 2 == 1) {
System.out.println(Thread.currentThread() + "" + number++);
} else {
synchronized (odd) {
synchronized (even) {
even.notify();
}
try {
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
}
static class EvenThread extends Thread {
@Override
public void run() {
while (number <= max) {
if (number % 2 == 0) {
System.out.println(Thread.currentThread() + "" + number++);
} else {
synchronized (even) {
synchronized (odd) {
odd.notify();
}
try {
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
}
public static void main(String[] args) throws InterruptedException {
odd = new OddThread();
even = new EvenThread();
odd.start();
even.start();
}
}
代替 parent::__construct();