(1):System.exit(int status)中的exit()方法用於中斷正在運行的JVM(Java虛擬機),其中的(int status)整形參數用來表示狀態碼。慣例來說,非零的狀態碼錶示異常終止,零狀態碼錶示正常終止整個程序。如果在try--catch中的catch塊中遇到System.out.exit(),則跳出程序,連finally也不執行
如:public static void main(String args[])
{
try
{
System.out.println("**************");
System.exit(0);
}
finally
{
System.out.exit("%%%%%%%%%%%%%");
}
}
(2):return只是返回,或一個方法的的停止,並不影響其它方法的執行(並沒有推出JVM)。
如: