易搜题 > 资格证大类 > 计算机编程 > 问题详情
问题详情

public class AssertStuff {  public static void main(String [] args) {  int x= 5;  int y= 7;  assert (x> y): “stuff”;  System.out.println(”passed”);  }  }  And these command line invocations:java AssertStuff java -ea AssertStuff What is the result?()

A、 passed stuff

B、 stuff passed

C、 passed  An AssertionError is thrown with the word “stuff” added to the stack trace.

D、 passed  An AssertionError is thrown without the word “stuff” added to the stack trace.

E、 passed  An AssertionException is thrown with the word “stuff” added to the stack trace.

F、 passed  An AssertionException is thrown without the word “stuff” added to the stack trace.

未找到的试题在搜索页框底部可快速提交,在会员中心"提交的题"查看可解决状态。 收藏该题
查看答案

相关问题推荐

  • 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.

  • Consider the following class:     class Test(int i) {     void test(int i) {  System.out.println(“I am an int.”); }    void test(String s) {   System.out.println(“I am a string.”);     }          public static void main(String args) {    Test t=new Test();     char ch=“y”;    t.test(ch);     }      }     Which of the statements below is true?()

    A、 Line 5 will not compile, because void methods cannot be overridden.

    B、 Line 12 will not compile, because there is no version of test() that rakes a charargument.

    C、 The code will compile but will throw an exception at line 12.

    D、 The code will compile and produce the following output: I am an int.

    E、 The code will compile and produce the following output: I am a String.

  • Which method in the Thread class is used to create and launch a new thread of execution?()

    A、 Run();

    B、 Start();

    C、 Execute();

    D、 Run(Runnable r);

    E、 Start(Runnable r);

    F、 Execute(Thread t);

  • Which two changes, taken together, would guarantee the output: 1, 2, 3, 4, 5?()

    A

    move the line 12 print statement into the foo() method

    B

    change line 7 to public synchronized void go(){

    C

    change the variable declaration on line 2 to private volatile int x;

    D

    wrap the code inside the foo() method with a synchronized(this) block

    E

    wrap the for loop code inside the go() method with a synchronized block synchronized(this){//for loop code here}

  • Assume that country is set for each class.  Given:  10. public class Money {  11. private String country, name;  12. public getCountry() { return country; }  13.}  and:  24. class Yen extends Money {  25. public String getCountry() { return super.country; }  26. }  27.  28. class Euro extends Money {  29. public String getCountry(String timeZone) {  30. return super.getCountry();  31. }  32. }  Which two are correct?()

    A

     Yen returns correct values.

    B

     Euro returns correct values.

    C

     An exception is thrown at runtime.

    D

     Yen and Euro both return correct values.

    E

     Compilation fails because of an error at line 25.

    F

     Compilation fails because of an error at line 30.

联系客服 会员中心
TOP