1. 기본 입출력
import java.util.Scanner;
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String str = sc.next();
String line = sc.nextLine();
System.out.println("출력");
System.out.print("출력");
2. 자료형과 형변환
int a = 10;
long b = 100L;
double c = 3.14;
char ch = 'A';
boolean flag = true;
String numStr = "123";
int num = Integer.parseInt(numStr);
String str = String.valueOf(num);
3. 배열
int[] arr = new int[5];
int[] arr2 = {1, 2, 3, 4, 5};
int[][] matrix = new int[3][4];
int[][] matrix2 = {{1,2}, {3,4}};
arr.length;
matrix.length;
matrix[0].length;
4. 문자열 처리
String str = "Hello World";
str.length();
str.charAt(0);
str.substring(0, 5);
str.indexOf("lo");
str.split(" ");
str.equals("Hello World");
str.toLowerCase();
str.toUpperCase();
StringBuilder sb = new StringBuilder();
sb.append("Hello");
sb.append(" World");
String result = sb.toString();
5. 반복문과 조건문
for(int i = 0; i < 10; i++) {
}
for(int num : arr) {
}
while(condition) {
}
if(condition) {
} else if(condition2) {
} else {
}

6. 컬렉션(Collection)
import java.util.*;
ArrayList<Integer> list = new ArrayList<>();
list.add(1);
list.get(0);
list.size();
list.remove(0);
HashMap<String, Integer> map = new HashMap<>();
map.put("key", 1);
map.get("key");
map.containsKey("key");
HashSet<Integer> set = new HashSet<>();
set.add(1);
set.contains(1);
7. 정렬
import java.util.Arrays;
import java.util.Collections;
int[] arr = {3, 1, 4, 1, 5};
Arrays.sort(arr);
ArrayList<Integer> list = new ArrayList<>();
Collections.sort(list);
Collections.sort(list, Collections.reverseOrder());
Arrays.sort(arr, (a, b) -> b - a);
8. 수학 관련
Math.max(a, b);
Math.min(a, b);
Math.abs(a);
Math.pow(2, 3);
Math.sqrt(16);
Math.ceil(3.2);
Math.floor(3.8);
9. 자주 사용하는 패턴
int max = Integer.MIN_VALUE;
int min = Integer.MAX_VALUE;
int INF = Integer.MAX_VALUE;
for(int i = 0; i < n; i++) {
for(int j = 0; j < m; j++) {
}
}
int[] dx = {-1, 1, 0, 0};
int[] dy = {0, 0, -1, 1};