throws가 아니다 s 가 빠진다.

발생 방법

3.구현 코드

package com.java.exception;

public class Exception07 {

	public static void main(String[] args) {  //caller
		// Exception > throw :s가 빠진다.(명시적 예외 처리)
		//개발자가 강제로 필요에 의해 예외를 발생 시킨 경우
		
		Exception07_2 c = new Exception07_2();
		
		try {
			
			c.callee();
			System.out.println("Hello");	
			
		}catch(Exception e){
			System.out.println("예외를 처리하였습니다.");
			e.printStackTrace();
			
		}
		System.out.println("World");
	}

}
package com.java.exception;

import java.io.IOException;

public class Exception07_2 {

	public void callee() throws Exception {  //callee 호출 받은 메서드
		
		System.out.println("callee메서드 시작");
		
		int []num = new int[2];
		num[0]=1;
		num[1]=2;
		
		//개발자가 임의로 예외만들어서 호출한 클래스의 메소드에게 던진다.
		**if(num.length ==2) throw new IOException("배열의 크기는 2입니다.");**
		
		//예외가 발생하면 아래 구문은 실행 되지 않는다.
		System.out.println("callee메서드 종료");
	}
}

Untitled