Java 17일차 1(예외 미루기)
public class ThrowsException { public static void printArray(int[] numbers) throws Exception { /*printArray 이 메소드를 예외 처리 할것이다.*/ for (int i = 0; i < 6; i++) { System.out.println(numbers[i]); } } public static void main(String[]args) { /*main 에서 throws 를 써서 예외 처리를 미루면 jvm 까지 간다.*/ int[]nums = new int [] {1,2,3,4,5}; try { /*예외처리 해주자.*/ printArray(nums); } catch (Exception e) { e.printStackTrace()..
2022.12.02