質問編集履歴

1

ソース追加

2019/08/28 07:41

投稿

tanaka002
tanaka002

スコア22

test CHANGED
File without changes
test CHANGED
@@ -1,6 +1,6 @@
1
1
  ```java
2
2
 
3
-
3
+ public class DraemonPoket {
4
4
 
5
5
  //配列型のフィールドを作成
6
6
 
@@ -66,6 +66,42 @@
66
66
 
67
67
 
68
68
 
69
+ ```java
70
+
71
+ public class Main14 {
72
+
73
+
74
+
75
+ public static void main(String [] args){
76
+
77
+
78
+
79
+ //インスタンスを作成してコマンドライン引数の長さを渡す。
80
+
81
+ DraemonPoket item = new DraemonPoket(args.length);
82
+
83
+
84
+
85
+ item.setItem(args[0]);
86
+
87
+ item.setItem(args[1]);
88
+
89
+ item.setItem(args[2]);
90
+
91
+ item.setItem(args[3]);
92
+
93
+
94
+
95
+ item.showItem();
96
+
97
+
98
+
99
+ }
100
+
101
+ }
102
+
103
+ ```
104
+
69
105
  コマンドライン引数で4つ道具をargsに渡しています。
70
106
 
71
107
  その道具をフィールドのprivate String[] itemListに一つずつ格納をしてshowItemで表示をたいです。