在main()方法中,赋值语句放在不同位置如何能够让程序运行起来?
public class Number {public static void main(String[] args) {
byte mybyte=124;
short myshort=32256;
int myint=45784612;
long mylong=46789451;
long result=mybyte+myshort+myint+mylong;
System.out.println("结果为:"+result);
}
}
public class Number {
byte mybyte=124; ——————————————>>>对前一个程序修改后:赋值语句放在这里,无法运行,那有没有什么方法能够运行程序?
short myshort=32256;
int myint=45784612;
long mylong=46789451;
public static void main(String[] args) {
long result=mybyte+myshort+myint+mylong;
System.out.println("结果为:"+result);
}
}