본문 바로가기

콩's EDUCATION/콩's JAVA_RUN

예외(Exception) 처리 기본

반응형

예외처리 기본 예제


 

public class ExceptionTest {
 public static void main(String[] args) {
  try{
  int i = Integer.parseInt(args[0]);
  int j = Integer.parseInt(args[1]);
  System.out.println(i/j);
  }
  catch (ArithmeticException e) {
   e.printStackTrace();
   System.out.println("0을 입력하지 마시오");
  }
  System.out.println("완료");
 }
}

 

 

 

ExceptionTest.java

 

반응형

'콩's EDUCATION > 콩's JAVA_RUN' 카테고리의 다른 글

throws 처리  (0) 2014.05.16
finally 처리  (0) 2014.05.16
Java 문제 4  (0) 2014.05.15
인터페이스(interface)  (0) 2014.05.15
추상(abstarct) 메소드  (0) 2014.05.15

⚠️ 광고 차단 프로그램 감지

애드블록, 유니콘 등 광고 차단 확장 프로그램을 해제하거나
화이트리스트에 추가해주세요.