teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

ソースの誤字や{}の全角半角についてご指摘がありましたので修正いたしました。

2020/11/01 04:11

投稿

ren_white_prg
ren_white_prg

スコア9

title CHANGED
File without changes
body CHANGED
@@ -5,14 +5,15 @@
5
5
  <事象>
6
6
  ケース①
7
7
  ```Java
8
- classItem{
8
+ class Item{
9
9
  String name;
10
- public ltem(String name) {
10
+ public Item(String name) {
11
11
  this.name = name;
12
-
12
+ }
13
-
13
+ }
14
+
14
15
  public class Sample {
15
- public static void main(String[] args) (
16
+ public static void main(String[] args) {
16
17
  Item[] items =new Item[3];
17
18
  items[1] = new Item("A");
18
19
  items[2] = new Item("B");
@@ -28,18 +29,18 @@
28
29
  ケース②
29
30
  ```Java
30
31
  public class Sample {
31
- public static final int length = 3;
32
+ public static final int length = 3;
32
- public static void main(String[] args) (
33
+ public static void main(String[] args) {
33
- int[] array = new int[length];
34
+ int[] array = new int[length];
34
- for(int i = 0; i < 3; i++){
35
+ for(int i = 0; i < 3; i++){
35
- System.out.print(array[i]);
36
+ System.out.print(array[i]);
36
- }
37
+ }
37
- System.out.println();
38
+ System.out.println();
38
- Integer[] array2 = new Integer[length];
39
+ Integer[] array2 = new Integer[length];
39
- for(int i =0; i < 3; i++){
40
+ for(int i =0; i < 3; i++){
40
- System.out.print(array2[i]);
41
+ System.out.print(array2[i]);
41
- }
42
+ }
42
- }
43
+ }
43
44
  }
44
45
  ```
45
46