public void control() { String isNum = new String(); int result = 0; String num1 = new String(); String num2 = new String(); while (true) { this.title(); this.output("첫번째 숫자를 입력해 주시겠습니까? : "); num1 = this.input(); if (this.isNum(num1)) { break; } }




public boolean isNum(String num) { boolean numbercheck; try { Integer.parseInt(num); numbercheck = true; } catch (Exception e) { numbercheck = false; } return numbercheck;


실습으로 계산기 만들면서 유효성 검사를 하는데
isNum을 이용해서 if구문에 넣는게 논리적으로 이해가 잘 안가요..
numbercheck는 변수를 왜 또 만드는지.

쉽게 이해할 수 있는 법이 있을까요?