各位大佬看看.为什么 return con放在(1)处可以运行,但是放在(2)处确报错
public class HelloWorld {
static int scores1=86;
static int scores2=92;
public static void main(String [] args){
HelloWorld hello=new HelloWorld();
int con=hello.sum();
System.out.println("总分:"+con);
}
public int sum(){
int con=scores1+scores2;
return con; //(1)处
}
//(2)处
}