Java_基礎-finallyキーワードの特徴と役割
1422 ワード
package com.soar.exception;
public class Demo7_Finally {
/*
* A:finally
* finally
* : finally jvm ( System.exit(0))
* B:finally
* , IO
* C:
* finally
* return , , finally
* finally finally
*/
public static void main(String[] args) {
try{
System.out.println(1/0);
}catch(Exception e){
System.out.println(" 0 ");
System.exit(0); // JVM
return ;
}finally{
System.out.println(" ");
}
}
}
転載先:https://www.cnblogs.com/soarsir/p/7652253.html