質問編集履歴

1

追記

2018/11/14 15:20

投稿

a.smile
a.smile

スコア13

test CHANGED
File without changes
test CHANGED
@@ -13,3 +13,39 @@
13
13
  System.out.println("総和は"+calSum(a));
14
14
 
15
15
  出力例;55
16
+
17
+
18
+
19
+
20
+
21
+ class MethodExample5_6{
22
+
23
+ public static int calsum(int a[]){
24
+
25
+ int sum=0;
26
+
27
+ for(int i=0;i<a.length;i++){
28
+
29
+ sum+=a[i];
30
+
31
+ /*System.out.println(sum);*/
32
+
33
+ }
34
+
35
+ return sum;
36
+
37
+
38
+
39
+ }
40
+
41
+ public static void main(String[] args){
42
+
43
+ int a[]={1,2,3,4,5,6,7,8,9,10};
44
+
45
+ System.out.println("総和は"+ calsum(a));
46
+
47
+ }
48
+
49
+ }
50
+
51
+ コメントアウトしている部分をもともとはコメントアウトしておらずエラーがでていたのですが、なぜだめだったのでしょうかといった疑問です。