我如何制作可以处理 IOException 的构造函数
这是带有构造函数的类
public class RootProcess {
Process process;
public RootProcess() throws IOException {
}
public RootProcess(Process process){
this.process = process;
}
public Process getProcess() {
return process;
}
public void setProcess(Process process) {
this.process = process;
}
}
这就是我声明它的方式
RootProcess process = new RootProcess(Runtime.getRuntime().exec("su"));
但我在eclipse中得到这个错误
Default constructor cannot handle exception type IOException thrown by implicit super constructor. Must define an explicit constructor