2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【Java】初期化、追加、取得

Posted at

配列

データ型 [] 配列名 = データ型 [要素数];

Array.java
String[] aaa = new String[100];
aaa[0] = "文章";
String bbb = aaa[0];

リスト

List<データ型> オブジェクト名 = new ArrayList<>();

List.java
List<String> aaa = new ArrayList<>();
aaa.add("AA");
aaa.get(0);

マップ

Map<キーの型, 値の型> オブジェクト名 = new HashMap<>();

Map.java
Map<Integer, String> aaa = new HashMap<>();
aaa.put(1, "文章");
aaa.get(1);

後記

解説はいらない、
初期化の方法をど忘れしたので、テキトーでいいからとりあえず動かしたいんだ……。
というときのために、迷わないように簡単なものだけ挙げています。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?