• 2021-04-14 问题

    try{if((newObject))(.equals((newObject()))){System.out.println(equal”);}else{System.out.println(notequal”);}}catch(Exceptione){System.out.println(exception”);}Whatistheresult?() A.equal B.notequal C.exception D.Compilationfails.

    try{if((newObject))(.equals((newObject()))){System.out.println(equal”);}else{System.out.println(notequal”);}}catch(Exceptione){System.out.println(exception”);}Whatistheresult?() A.equal B.notequal C.exception D.Compilationfails.

  • 2021-04-14 问题

    publicstaticvoidparse(Stringstr){try{floatf=Float.parseFloat(str);}catch(NumberFormatExceptionnfe){f=0;}finally{System.out.println(f);}}publicstaticvoidmain(String[]args){parse(”invalid”);}Whatistheresult?() A.0.0 B.Compilationfails. C.AParseExceptionisthrownbytheparsemethodatruntime. D.ANumberFormatExceptionisthrownbytheparsemethodatruntime.

    publicstaticvoidparse(Stringstr){try{floatf=Float.parseFloat(str);}catch(NumberFormatExceptionnfe){f=0;}finally{System.out.println(f);}}publicstaticvoidmain(String[]args){parse(”invalid”);}Whatistheresult?() A.0.0 B.Compilationfails. C.AParseExceptionisthrownbytheparsemethodatruntime. D.ANumberFormatExceptionisthrownbytheparsemethodatruntime.

  • 1