class Beta{ public static void main(String[] args){ Integer x=new Integer(6)*7; if(x!=42){ System.out.print(“42”); } else if(xSystem.out.println(“less”); }else{ System.out.print(“done”); }}} 结果是什么?() A、doneB、编译失败C、运行的时候有异常抛出D、lessE、42
class Beta{ public static void main(String[] args){ Integer x=new Integer(6)*7; if(x!=42){ System.out.print(“42”); } else if(x
- A、done
- B、编译失败
- C、运行的时候有异常抛出
- D、less
- E、42
相关考题:
classBeta{publicstaticvoidmain(String[]args){Integerx=newInteger(6)*7;if(x!=42){System.out.print(42”);}elseif(xSystem.out.println(less”);}else{System.out.print(done”);}}}结果是什么?() A.doneB.编译失败C.运行的时候有异常抛出D.lessE.42
classBeta{publicstaticvoidmain(String[]args){Integerx=newInteger(6)*7;if(x!=42){System.out.print(42);}elseif(x.equals(42)){System.out.print(dot=);}else{System.out.print(done);}}}结果为:()A.42B.doneC.dot=D.编译失败
classBeta{publicstaticvoidmain(String[]args){Integerx=newInteger(6)*7;if(x!=42){System.out.print(42);}elseif(x〈newInteger(44-1)){System.out.println(less);}else{System.out.print(done);}}}结果是什么?()A.lessB.42C.doneD.编译失败
class Flibitz{ public static void main(String[] args){ int grop=7; new Flibitz().go(grop); System.out.print(grop); } void go(int grop){ if(++grop7) grop++; System.out.print(grop); } } 结果为:() A、99B、编译失败C、运行时异常被抛出D、77E、79F、97
class Beta { public static void main(String [] args) { Integer x = new Integer(6) * 7; if (x != 42) { System.out.print("42 "); } else if (x 〈 new Integer(44-1)) { System.out.println("less"); } else { System.out.print("done"); } } } 结果是什么?() A、lessB、42C、doneD、编译失败
现有: class Parser (类)extends(继承) Utils { public static void main(String [] args) { System.out.print(输出打印)(new Parser().getInt("42")); } int getInt(String arg) { return Integer.parseInt(arg); } } class Utils { int getInt(String arg) throws Exception { return 42; } } 结果为:() A、 42B、 编译失败。C、 无输出结果。D、 运行时异常被抛出。
现有 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 () { return 42; } } 结果是什么?() A、 42ExcB、 ExcC、 42D、编译失败
class Number { public static void main(String [] args) { try { System.out.print(Integer.parseInt("forty ")); } catch (RuntimeException r) { System.out.print("runtime "); } catch (NumberFormatException e) { System.out.print("number "); } } } 结果是什么?() A、fortyB、numberC、runtimeD、编译失败
现有: class Parser extends Utils { public static void main(String [] args) { System.out.print(new Parser().getInt("42")); } int getInt(String arg) { return Integer.parseInt(arg); } } class Utils { int getInt(String arg) throws Exception { return 42; } } 结果为() A、 42B、 编译失败。C、 无输出结果。D、 运行时异常被抛出。
class Bird { static void talk() { System.out.print("chirp "); } } class Parrot extends Bird { static void talk() { System.out.print("hello "); } public static void main(String [] args) { Bird [] birds = {new Bird(), new Parrot()}; for( Bird b : birds) b.talk(); } } 结果为:() A、chirp chirpB、chirp helloC、hello helloD、编译失败
class ThreadExcept implements Runnable { public void run() { throw new RuntimeException("exception "); } public static void main(String [] args) { new Thread(new ThreadExcept()).start(); try { int x = Integer.parseInt(args[0]); Thread.sleep(x); System.out.print("main "); } catch (Exception e) { } } } 和命令行: java ThreadExcept 1000 哪一个是结果?() A、 mainB、 编译失败C、 代码运行,但没有输出D、 main java.lang.RuntimeException:exception
现有: import java.util.*; class ScanStuff { public static void main (String [] args) { String S= "x,yy,123"; Scanner sc = new Scanner (s); while (sc.hasNext()) System.out.print (sc.next() +" "); } } 结果是什么?() A、 x yyB、 x,yy,123C、 x yy 123D、 x,yyE、编译失败F、运行的时候有异常抛出
class Beta { public static void main(String [] args) { Integer x = new Integer(6) * 7; if (x != 42) { System.out.print("42 "); } else if (x.equals(42)) { System.out.print("dot = "); } else { System.out.print("done"); } } } 结果为:() A、42B、doneC、dot =D、编译失败
class Parser extends Utils { public static void main (String [] args) { try { System.out.print(new Parser().getInt("42")); } catch (NumberFormatException n) { System.out.println("NFExc "); } } int getInt(String arg) throws NumberFormatException { return Integer.parseInt(arg); } } class Utils { int getInt(String arg) { return 42; } } 结果为:() A、42B、NFExcC、42NFExcD、编译失败
class Passer { static final int x = 5; public static void main(String [] args) { new Passer().go(x); System.out.print(x); } void go(int x) { System.out.print(++x); } } 结果是什么?() A、55B、56C、65D、66
现有: 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、 NFExcB、 42C、 42NFExcD、编译失败
class Beverage { Beverage() { System.out.print("beverage "); } } class Beer extends Beverage { public static void main(String [] args) { Beer b = new Beer(14); } public int Beer(int x) { this(); System.out.print("beer1 "); } public Beer() { System.out.print("beer2 "); } } 结果是什么?() A、beer1 beverageB、beer2 beverageC、beverage beer1D、编译失败
class Test2{ public static void main(String [] args){ boolean x=true; boolean y=false; short z=42; if((x==true)y=true))z++; if((y==true||++z=44))z++; System.out.println(“z=”+z); } } 结果是什么?() A、 z=42B、 z=43C、z=44D、 z=45E、编译失败F、运行的时候有异常抛出
class Parser extends Utils { public static void main(String [] args) { System.out.print(new Parser().getInt("42")); } int getInt(String arg) { return Integer.parseInt(arg); } } class Utils { int getInt(String arg) throws Exception { return 42; } } 结果为:() A、42B、编译失败C、无输出结果D、运行时异常被抛出
单选题现有: 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 42B ExcC 42ExcD编译失败
单选题现有: 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 NFExcB 42C 42NFExcD编译失败
单选题class Beta{ public static void main(String[] args){ Integer x=new Integer(6)*7; if(x!=42){ System.out.print(“42”); } else if(xSystem.out.println(“less”); }else{ System.out.print(“done”); }}} 结果是什么?()AdoneB编译失败C运行的时候有异常抛出DlessE42
单选题现有: import java.util.*; class ScanStuff { public static void main (String [] args) { String S= "x,yy,123"; Scanner sc = new Scanner (s); while (sc.hasNext()) System.out.print (sc.next() +" "); } } 结果是什么?()A x yyB x,yy,123C x yy 123D x,yyE编译失败F运行的时候有异常抛出
单选题class Beta { public static void main(String [] args) { Integer x = new Integer(6) * 7; if (x != 42) { System.out.print("42 "); } else if (x 〈 new Integer(44-1)) { System.out.println("less"); } else { System.out.print("done"); } } } 结果是什么?()AlessB42CdoneD编译失败
单选题现有: class ThreadExcept implements Runnable { public void run() { throw new RuntimeException("exception "); } public static void main(String [] args) { new Thread(new ThreadExcept()).start(); try { int x = Integer.parseInt(args[0]); Thread.sleep(x); System.out.print("main "); } catch (Exception e) { } } } 和命令行: java ThreadExcept 1000 哪一个是结果?()A mainB 编译失败C 代码运行,但没有输出D main java.lang.RuntimeException: exception
单选题现有 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 () { return 42; } } 结果是什么?()A 42ExcB ExcC 42D编译失败
单选题class Beta { public static void main(String [] args) { Integer x = new Integer(6) * 7; if (x != 42) { System.out.print("42 "); } else if (x.equals(42)) { System.out.print("dot = "); } else { System.out.print("done"); } } } 结果为:()A42BdoneCdot =D编译失败