

Java의 substring 메서드는 문자열에서 특정 부분을 추출할 때 사용된다.
substring은 두 가지 형태로 사용된다:
substring(int beginIndex)
beginIndex 위치부터 문자열 끝까지 반환.substring(int beginIndex, int endIndex)
beginIndex 위치부터 endIndex 직전까지의 부분 문자열을 반환. endIndex는 포함되지 않는다.String str = "Hello, World!";
System.out.println(str.substring(0, 1)); // H (첫 번째 문자)
System.out.println(str.substring(str.length() - 1)); // ! (마지막 문자)
System.out.println(str.substring(7, 12)); // World (7~11 인덱스)