Notice
Recent Posts
Recent Comments
Link
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

WON.dev

chapter07 : exception 본문

JAVA/chapter19_exception

chapter07 : exception

GAWON 2023. 5. 30. 09:31
package org.joonzis.ex;

public class Ex07_exception {
	public static void divide(int num1, int num2) throws ArithmeticException {
		System.out.println("몫 : " + (num1 / num2));
		System.out.println("나머지 : " + (num1 % num2));
	}
	
	// try-catch 하기 싫으면 떠넘기자
	public static void main(String[] args) throws ArithmeticException{
		divide(5, 2);
		divide(5, 0);
	}
}

'JAVA > chapter19_exception' 카테고리의 다른 글

chapter09 : exception  (0) 2023.05.30
chapter08 : exception  (0) 2023.05.30
chapter06 : exception  (0) 2023.05.30
chapter05 : exception  (0) 2023.05.30
chapter04 : exception  (0) 2023.05.30