EX)
<입력>
Scanner sc = new Scanner(System.in);
System.out.print("문자열입력: ");
String str1 = sc.nextLine();
System.out.println(str1);
System.out.print("문자열입력: ");
String str2 = sc.next();
System.out.println(str2);
EX)
<출력>
문자열입력: 안녕하세요 반갑습니다. //nextLine() 사용
안녕하세요 반갑습니다.
문자열입력: 안녕하세요 반갑습니다. //next() 사용
안녕하세요
32비트에서 Int 정수 범위는 -2,147,483,648 ~ 2,147,483,647 이다.
따라서 32비트 Int 정수의 최대값은 2,147,483,647 이고, 최소값은 -2,147,483,648 이다.
(64비트에서도 정수의 경우 32비트와 마찬가지로 4byte라서 같다.)
Integer 클래스의 MAX_VALUE, MIN_VALUE를 사용하면 정수의 최대값(2,147,483,647)과 최소값(-2,147,483,648)을 바로 출력할 수 있다.