Created
February 18, 2020 13:43
-
-
Save xodhx4/bf898fdb39503a7d6b9bb3ac7154badc to your computer and use it in GitHub Desktop.
[ArrayList 사용법] 기본적인 ArrayList의 사용법 #ArrayList #add #get #sort
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void addArrayList() { | |
ArrayList<Integer> lists = new ArrayList<>(); | |
for (int i =0; i<9; i++) { | |
lists.add(i); | |
} | |
for (int i =0; i<9; i++) { | |
lists.get(i); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void sortArray() { | |
ArrayList<Integer> lists = new ArrayList<>(); | |
for (int i =0; i<9; i++) { | |
lists.add(sc.nextInt()); | |
} | |
// TODO : ArrayList 오름차순 정렬 | |
lists.sort(null); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment