#7553: 我用別的網頁編譯都正常執行都可,為何會出現NA


billaz123 (billaz123)


import java.util.Scanner;
class test{
public static void main(String args[]){
    
Scanner Scanner = new Scanner(System.in);
int a,b,c,d,e,f;
        
a=Scanner.nextInt();
b=Scanner.nextInt();
d=Scanner.nextInt();
e=Scanner.nextInt();
c=a+b;
f=d+e;
System.out.printf("%d",c);
System.out.println("");
System.out.printf("%d",f);
}
}
-------------------------------------
我用命令提示字元或者線上的編譯器都可以正常執行,會和這邊還是出現NA 
#7559: Re:我用別的網頁編譯都正常執行都可,為何會出現NA


tomoyaken14 (歐練)


import java.util.Scanner;
class test{
public static void main(String args[]){
    
Scanner Scanner = new Scanner(System.in);
int a,b,c,d,e,f;
        
a=Scanner.nextInt();
b=Scanner.nextInt();
d=Scanner.nextInt();
e=Scanner.nextInt();
c=a+b;
f=d+e;
System.out.printf("%d",c);
System.out.println("");
System.out.printf("%d",f);
}
}
-------------------------------------
我用命令提示字元或者線上的編譯器都可以正常執行,會和這邊還是出現NA 


輸入不只有兩筆...請用while

Scanner Scanner <建議第二個Scanner 的S改成小寫s,你這樣寫會非常非常非常非常的危險