单项选择题
现有:
class Parser extends Utils {
public static void main (String[] args) {
try{System.out.print (new Parser().getlnt("42"));
} catch (Exception e) {
System.out.println("Exc"); }
}
int getlnt (String arg) throws Exception {
return Integer.parselnt (arg);
}
class Utils {
int getlnt (String arg) {return 42; }
}
结果为()
A. 42
B. Exc
C. 42Exc
D.编译失败
点击查看答案&解析
相关考题
-
单项选择题
现有: class Parser extends Utilis { public static void main (String [] args) { try { System. out.print (new Parser ( ) .getlnt ("42")} ; } catch (NumberFormatException n) { System.out .println ( "NFExc" ) ; } } int getlnt (String arg) throws NumberFormatException{ return Integer.parselnt (arg) ; } class Utils { int getlnt (String arg) { return 42; } } 结果为 :()
A. NFExc
B. 42
C. 42NFExc
D.编译失败 -
单项选择题
现有: class Birds { public static void main (String [] args) { try { throw new Exception () ; } catch (Exception e) { try { throw new Exception () ; } catch (Exception e2) { System.out.print ("inner "); } System. out.print ( "middle" ) ; } System.out.print ("outer") ; } } 结果是()
A. inner outer
B. middle outer
C. inner middle outer
D..编译失败 -
多项选择题
现有: class Flow { public static void main(String [] args) try { System. out .print ("before") ; doRiskyThing ( ) ; System.out.print ("after ") ; } catch (Exception fe) { System.out.print ("catch") ; } System. out .println ( " done") ; } public static void doRiskyThing() throws Exception{ // this code returns unless it throws an Exception }} 可能会产生哪两项结果 ?()
A. before catch
B. before after done
C. before catch done
D. before after catch
