以下程序段的输出结果为 .以下程序段的输出结果为 .\x05public class TryCatchFinally{\x05static void Proc( int sel ){\x05\x05try{\x05\x05 if( sel==0 ){System.out.print("no Exception ");\x05\x05\x05\x05return;}\x05\x05 else if( sel==

来源:学生作业帮助网 编辑:作业帮 时间:2024/08/31 19:49:36
以下程序段的输出结果为 .以下程序段的输出结果为 .\x05public class TryCatchFinally{\x05static void Proc( int sel ){\x05\x05try{\x05\x05 if( sel==0 ){System.out.print(
xn@_+GBN`*X#pIkplDUAh-B(Hˌ/] ֺҬY47Fbo=k~zNW/ɝvfeIQ nE+7$EXT@pSWE$d(DlaAjrZ-QRū&5r "Ұ*P(q6uxH6)R׋).?Ts#%|ޜ<9eUR,;BHdrpMJ O3AP#~Ϟ*2(*:FQ=yC&(Ȅ,&%p-AR8X lܾ{PgEV?Tk J~NI|pxHbH=-]j qo#֒S;zvNF5{B؛>l*?m*`/oz#ݣ(#Nn働 T/.Nc%Pbou#~)2J{O

以下程序段的输出结果为 .以下程序段的输出结果为 .\x05public class TryCatchFinally{\x05static void Proc( int sel ){\x05\x05try{\x05\x05 if( sel==0 ){System.out.print("no Exception ");\x05\x05\x05\x05return;}\x05\x05 else if( sel==
以下程序段的输出结果为 .
以下程序段的输出结果为 .
\x05public class TryCatchFinally{
\x05static void Proc( int sel ){
\x05\x05try{
\x05\x05 if( sel==0 ){System.out.print("no Exception ");
\x05\x05\x05\x05return;}
\x05\x05 else if( sel==1 ){ int j = 4/0; }
\x05\x05\x05}
\x05\x05catch( ArithmeticException e ) {
\x05\x05\x05System.out.print("catch "); }
\x05\x05catch( Exception e ) {
\x05\x05\x05System.out.print("will not be executed ");}
\x05\x05finally{
\x05\x05\x05System.out.print("finally "); \x05}
\x05}
public static void main( String args[] ){
\x05 Proc( 1 ); \x05}
\x05}

以下程序段的输出结果为 .以下程序段的输出结果为 .\x05public class TryCatchFinally{\x05static void Proc( int sel ){\x05\x05try{\x05\x05 if( sel==0 ){System.out.print("no Exception ");\x05\x05\x05\x05return;}\x05\x05 else if( sel==
打印结果为: catch finally .第二个 catch 不输出
这段代码考查的是try catch finally 的执行顺序.怎么捕获异常的.
与 switch 相关,遇到第一个满足条件则执行.然后跳到finally.
类似于switch 中的case break; default..