유틸리티 메소드
package day8; import java.util.Scanner; public class Util { // 숫자 체크 메소드 public int numberCheck() { int result; Scanner sc = new Scanner(System.in); while (true) { if (sc.hasNextInt()) { // 입력한 값이 숫자면 result = sc.nextInt(); break; } else { System.out.print(“숫자만 입력>”); sc.nextLine(); } } return result; // 입력한 값을 result에 저장 } public int … Read more