10 http cafe naver comthisjava 117 Number Format
![10장. 예외처리 이것이 자바다(http: //cafe. naver. com/thisjava) 1/17 10장. 예외처리 이것이 자바다(http: //cafe. naver. com/thisjava) 1/17](https://slidetodoc.com/presentation_image_h/e8f4693303f0b86502d7c7512a2bbd42/image-1.jpg)
10장. 예외처리 이것이 자바다(http: //cafe. naver. com/thisjava) 1/17
![](http://slidetodoc.com/presentation_image_h/e8f4693303f0b86502d7c7512a2bbd42/image-2.jpg)
![](http://slidetodoc.com/presentation_image_h/e8f4693303f0b86502d7c7512a2bbd42/image-3.jpg)
![](http://slidetodoc.com/presentation_image_h/e8f4693303f0b86502d7c7512a2bbd42/image-4.jpg)
![](http://slidetodoc.com/presentation_image_h/e8f4693303f0b86502d7c7512a2bbd42/image-5.jpg)
![](http://slidetodoc.com/presentation_image_h/e8f4693303f0b86502d7c7512a2bbd42/image-6.jpg)
![](http://slidetodoc.com/presentation_image_h/e8f4693303f0b86502d7c7512a2bbd42/image-7.jpg)
![](http://slidetodoc.com/presentation_image_h/e8f4693303f0b86502d7c7512a2bbd42/image-8.jpg)
![Number. Format. Exception v Integer. parse. Int(String s) - 정수로 변환 v Integer. parse. Number. Format. Exception v Integer. parse. Int(String s) - 정수로 변환 v Integer. parse.](http://slidetodoc.com/presentation_image_h/e8f4693303f0b86502d7c7512a2bbd42/image-9.jpg)
Number. Format. Exception v Integer. parse. Int(String s) - 정수로 변환 v Integer. parse. Double(String s) – 실수로 변환 v 숫자로 변환될 수 없는 문자가 포함되어 있으면 Number. Format. Exception 발생 String data 1=“ 100”; String data 2 = “a 200”; Sytem. out. println(Integer. parse. Int(data 1) + Integer. parse. Int(data 2)); 9/17
![](http://slidetodoc.com/presentation_image_h/e8f4693303f0b86502d7c7512a2bbd42/image-10.jpg)
![](http://slidetodoc.com/presentation_image_h/e8f4693303f0b86502d7c7512a2bbd42/image-11.jpg)
![](http://slidetodoc.com/presentation_image_h/e8f4693303f0b86502d7c7512a2bbd42/image-12.jpg)
![](http://slidetodoc.com/presentation_image_h/e8f4693303f0b86502d7c7512a2bbd42/image-13.jpg)
![](http://slidetodoc.com/presentation_image_h/e8f4693303f0b86502d7c7512a2bbd42/image-14.jpg)
![(2)상위 메소드로 전달 // throwable class 15/17 (2)상위 메소드로 전달 // throwable class 15/17](http://slidetodoc.com/presentation_image_h/e8f4693303f0b86502d7c7512a2bbd42/image-15.jpg)
(2)상위 메소드로 전달 // throwable class 15/17
![](http://slidetodoc.com/presentation_image_h/e8f4693303f0b86502d7c7512a2bbd42/image-16.jpg)
![](http://slidetodoc.com/presentation_image_h/e8f4693303f0b86502d7c7512a2bbd42/image-17.jpg)
![](http://slidetodoc.com/presentation_image_h/e8f4693303f0b86502d7c7512a2bbd42/image-18.jpg)
![](http://slidetodoc.com/presentation_image_h/e8f4693303f0b86502d7c7512a2bbd42/image-19.jpg)
![사용자 정의 예외 예제 class Divide. By. Zero. Exception extends Arithmetic. Exception { public 사용자 정의 예외 예제 class Divide. By. Zero. Exception extends Arithmetic. Exception { public](http://slidetodoc.com/presentation_image_h/e8f4693303f0b86502d7c7512a2bbd42/image-20.jpg)
사용자 정의 예외 예제 class Divide. By. Zero. Exception extends Arithmetic. Exception { public Divide. By. Zero. Exception() { super("0으로 나눌 수는 없음"); //수퍼 클래스의 생성자 호출하여 에러 메시지 저장 } } public class Exception. Test { public static void main(String[] args) { doubleresult; try { result = quotient(1, 0); } catch (Divide. By. Zero. Exception e) { System. out. println(e. get. Message()); } } public static double quotient(int n, int d) throws Divide. By. Zero. Exception { if (d == 0) throw new Divide. By. Zero. Exception(); return (double) n/d; } } 20/17
![](http://slidetodoc.com/presentation_image_h/e8f4693303f0b86502d7c7512a2bbd42/image-21.jpg)
![](http://slidetodoc.com/presentation_image_h/e8f4693303f0b86502d7c7512a2bbd42/image-22.jpg)
![](http://slidetodoc.com/presentation_image_h/e8f4693303f0b86502d7c7512a2bbd42/image-23.jpg)
![이것이 자바다(http: //cafe. naver. com/thisjava) 24/17 이것이 자바다(http: //cafe. naver. com/thisjava) 24/17](http://slidetodoc.com/presentation_image_h/e8f4693303f0b86502d7c7512a2bbd42/image-24.jpg)
이것이 자바다(http: //cafe. naver. com/thisjava) 24/17
- Slides: 24