관리 메뉴

moozi

java 정수체크 본문

TIS_2017/응용sw_1기

java 정수체크

moozi 2016. 12. 15. 17:10


public class NumberCheck {


public static void main(String[] args) {

String s1="abcd";

String s2="1234";

System.out.println(isNumber(s1));

System.out.println(isNumber(s2));

}


public static boolean isNumber(String str){

        boolean result = false;          

         

        try{

            Integer.parseInt(str) ;

            result = true ;

        }catch(Exception e){}

         

         

        return result ;

    }

}



'TIS_2017 > 응용sw_1기' 카테고리의 다른 글

java연습문제11  (0) 2016.12.16
chat01  (0) 2016.12.16
java연습문제10  (0) 2016.12.15
12/15 오전 수업자료  (0) 2016.12.15
java연습문제09  (0) 2016.12.14
Comments