throwsexception.java

来自「半年的java基础联系源码!现在看了破!对于初学java的朋友能帮上忙就用吧」· Java 代码 · 共 38 行

JAVA
38
字号
  
   public class throwsException{
	static void Proc( int sel )
				throws ArithmeticException,ArrayIndexOutOfBoundsException{
		
		System.out.println("----- In Situation"+sel+" -----");

		if( sel==0 ){
			System.out.println("no Exception caught");
			return;
		}else if( sel==1 ){
			int iArray[]=new int[4];
			iArray[10]=3;
		}
	}


	public static void main( String args[] ){
		try{
			Proc( 0 );
			Proc( 1 );
		}catch( ArrayIndexOutOfBoundsException e ){
			System.out.println("Catch "+e);
		}finally{
			System.out.println("in Proc finally");
		}
	}

   }

 




 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?