Java认证考试综合练习

单选题public class Yippee2{ stati cpublic void main(String[]yahoo){ for(intx=1;x A abB bcC abcD Compilation fails.E An exception is thrown at runtime.

题目
单选题
public class Yippee2{ stati cpublic void main(String[]yahoo){ for(intx=1;x
A

ab

B

bc

C

abc

D

Compilation fails.

E

An exception is thrown at runtime.

如果没有搜索结果,请直接 联系老师 获取答案。
如果没有搜索结果,请直接 联系老师 获取答案。
相似问题和答案

第1题:

public class Yippee2 {  static public void main(String [] yahoo) {  for(int x= 1; xSystem.out.print(yahoo[x] + “ “);  }  }  }  and the command line invocation: java Yippee2 a b c What is the result?() 

  • A、a b
  • B、b c
  • C、a b c
  • D、 Compilation fails.
  • E、 An exception is thrown at runtime.

正确答案:B

第2题:

interface DeclareStuff{  public static final int EASY = 3;  void doStuff(int t); }  public class TestDeclare implements DeclareStuff {  public static void main(String [] args) {  int x=5;  new TestDeclare().doStuff(++x);  }  void doStuff(int s) {  s += EASY + ++s;  System.out.println(”s “ + s);  }  }  What is the result?() 

  • A、 s 14
  • B、 s 16
  • C、 s 10
  • D、 Compilation fails.
  • E、 An exception is thrown at runtime.

正确答案:D

第3题:

public class Yippee2{stati cpublic void main(String[]yahoo){for(intx=1;xSystem.out.print(yahoo[x]+"");}}}and the command line invocation:java Yippee2 a b cWhat is the result?()

A.ab

B.bc

C.abc

D.Compilation fails.

E.An exception is thrown at runtime.


参考答案:B

第4题:

class TestA {  public void start() { System.out.println(”TestA”); }  }  public class TestB extends TestA {  public void start() { System.out.println(”TestB”); } public static void main(String[] args) {  ((TestA)new TestB()).start();  }  }  What is the result?() 

  • A、 TestA
  • B、 TestB
  • C、 Compilation fails.
  • D、 An exception is thrown at runtime.

正确答案:B

第5题:

public class Alpha{  public static void main( string[] args ){  if ( args.length == 2 ) {  if ( args.[0].equalsIgnoreCase(“-b”) )  System.out.println( new Boolean( args[1] ));  }  }  }   And the code is invoked by using the command: java Alpha –b TRUE   What is the result?()  

  • A、 true
  • B、 null
  • C、 false
  • D、 Compilation fails.
  • E、 The code runs with no output.
  • F、 An exception is thrown at runtime.

正确答案:A

第6题:

public static void main(String[] args) {  String str = “null‟;  if (str == null) {  System.out.println(”null”);  } else (str.length() == 0) {  System.out.println(”zero”);  } else {  System.out.println(”some”);  }  }  What is the result?()

  • A、 null
  • B、 zero
  • C、 some
  • D、 Compilation fails.
  • E、 An exception is thrown at runtime.

正确答案:D

第7题:

public class Yippee2{ stati cpublic void main(String[]yahoo){ for(intx=1;x

  • A、ab
  • B、bc
  • C、abc
  • D、Compilation fails.
  • E、An exception is thrown at runtime.

正确答案:B

第8题:

public class TestString 1 {  public static void main(String[] args) {  String str = “420”;  str += 42;  System.out.print(str);  }  }  What is the output?()

  • A、 42
  • B、 420
  • C、 462
  • D、 42042
  • E、 Compilation fails.
  • F、 An exception is thrown at runtime.

正确答案:D

第9题:

public class Test {  public enum Dogs {collie, harrier, shepherd};  public static void main(String [] args) {  Dogs myDog = Dogs.shepherd;  switch (myDog) {  case collie:  System.out.print(”collie “);  case default:  System.out.print(”retriever “); case harrier:  System.out.print(”harrier “);  }  }  }  What is the result?() 

  • A、 harrier
  • B、 shepherd
  • C、 retriever
  • D、 Compilation fails.
  • E、 retriever harrier
  • F、 An exception is thrown at runtime.

正确答案:D

第10题:

public class Test {  public static void main(String[] args) {  String str = NULL;  System.out.println(str);  }  }   What is the result?()  

  • A、 NULL
  • B、 Compilation fails.
  • C、 The code runs with no output.
  • D、 An exception is thrown at runtime.

正确答案:B

更多相关问题