#22822: 新手java不太會:((((( 請問這樣正確嗎 在測試的過程中 出現下面那些英文 有人知道是什麼意思嗎 求解!感恩!!


alan0927 (iiiqqe)

School : No School
ID : 110592
IP address : [61.223.119.62]
Last Login :
2021-01-05 21:20:04
b294. 經濟大恐荒 -- 板橋高中教學題 | From: [61.223.110.63] | Post Date : 2020-10-04 23:43

import java.util.Scanner;

public class ghj

{

public static void main(String[] args )

{

Scanner scanner = new Scanner(System.in);

 

int number = scanner.nextInt();

 

Scanner nb = new Scanner(System.in);

 

int a[]=new int [100];

for (int i=1;i<number+1;i++)

{

a[i]=nb.nextInt();

}

 

int sum=0;

 

for(int i=0;i<number+1;i++)

 

{

sum=sum+a[i]*i;

}

 

System.out.print(sum);

 

}

 

}

 

--------------------------------------------------------------------------------------------------------------------------------------------------------------

 

/6432363/JAVA.java:2: error: class ghj is public, should be declared in a file named ghj.java
public class ghj
       ^
1 error

 

 

 

 
ZeroJudge Forum