1234567891011121314151617181920 |
- package com.sf.javase.day11.exception;
- public class MyExceptionTest {
- public void regist(int age) throws MyException {
- if(age<0){
- throw new MyException("age<0",1);
- }else System.out.println("====");
- }
- public void regist1(int age) throws MyException {
- try {
- int c = age;
- }catch (RuntimeException e){
- throw new MyException("age<0",2);
- // ArrayIndexOutOfBoundsException
- }
- }
- }
|