【发布时间】:2013-07-26 11:39:40
【问题描述】:
我正在制作一个迷你java游戏,编译时出错:
error:invalid method declaration;return type requied
public init() throws Exception {
^
第一个版本是 public void init,但我不能那样做,因为我需要使用 try{..}catch(Malformed...) 或者在编译时出现另一个错误(需要 catch blah blah)。
这是代码:
public void run() throws Exception{
try{
this.zz();
}catch(MalformedURLException me){
throw me;
}
this.zo();
}
【问题讨论】:
-
public void init() 抛出异常
-
public int init() 抛出异常。添加返回类型。
标签: java url exception init malformed