多选题11. public class Commander {  12. public static void main(String[] args) {  13. String myProp = /* insert code here */  14. System.out.println(myProp);  15. }  16. }  and the command line:  java -Dprop.custom=gobstopper Commander  Which two, placed on 

题目
多选题
11. public class Commander {  12. public static void main(String[] args) {  13. String myProp = /* insert code here */  14. System.out.println(myProp);  15. }  16. }  and the command line:  java -Dprop.custom=gobstopper Commander  Which two, placed on line 13, will produce the output gobstopper?()
A

System.load(”prop.custom”);

B

System.getenv(”prop.custom”);

C

System.property(”prop.custom”);

D

System.getProperty(”prop.custom”);

E

System.getProperties().getProperty(”prop.custom”);


相似考题
更多“11. public class Commander {  12. public static void main(St”相关问题
  • 第1题:

    单选题
    1. public class SwitchTest {  2. public static void main (String []args)  {  3. System.out.PrintIn(“value =” +switchIt(4));  4. }  5. public static int switchIt(int x)  {  6. int j = 1;  7. switch (x) {  8. case 1: j++;  9. case 2: j++;  10. case 3: j++;  11. case 4: j++;  12. case 5: j++;  13. default:j++;  14. }  15. return j + x;  16. }  17. }     What is the output from line 3?()
    A

     Value = 3

    B

     Value = 4

    C

     Value = 5

    D

     Value = 6

    E

     Value = 7

    F

     Value = 8


    正确答案: B
    解析: 暂无解析

  • 第2题:

    单选题
    public class Threads5 {  public static void main (String[] args) {  new Thread(new Runnable() {  public void run() {  System.out.print(”bar”);  } }).start();  }  }  What is the result?()
    A

     Compilation fails.

    B

     An exception is thrown at runtime.

    C

     The code executes normally and prints “bar”.

    D

     The code executes normally, but nothing prints.


    正确答案: A
    解析: 暂无解析

  • 第3题:

    单选题
    A class games.cards.Poker is correctly defined in the jar file Poker.jar.  A user wants to execute the main method of Poker on a UNIX system using the command:  java games.cards.Poker  What allows the user to do this?()
    A

     put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java

    B

     put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java/*.jar

    C

     Put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java/Poker.jar

    D

     put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include /stuff/java

    E

     put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include /stuffijava/*.jar

    F

     put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include /stuff/java/Poker.jar


    正确答案: C
    解析: 暂无解析

  • 第4题:

    单选题
    An object is()
    A

    what classes are instantiated from.

    B

    an instance of a class.

    C

    a blueprint for creating concrete realization of abstractions.

    D

    a reference to an attribute.

    E

    a variable.


    正确答案: B
    解析: 暂无解析

  • 第5题:

    单选题
    public class X implements Runnable (   private int x;   private int y;    public static void main(String args) (   X that = new X();   (new Thread(that)) . start( );   (new Thread(that)) . start( );   )    public synchronized void run( ) (    for (;;) (    x++;    y++;    System.out.printIn(“x = “ + x + “, y = “ + y);    )   )    )   What is the result?()
    A

     An error at line 11 causes compilation to fail.

    B

     Errors at lines 7 and 8 cause compilation to fail.

    C

     The program prints pairs of values for x and y that might not always be the same on the same line  (for example, “x=2, y=1”)

    D

     The program prints pairs of values for x and y that are always the same on the same line (forexample, “x=1, y=1”. In addition, each value appears twice (for example, “x=1, y=1” followed by  “x=1, y=1”)

    E

     The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears twice (for example, “x=1, y=1” followed by  “x=2s, y=2”)


    正确答案: A
    解析: 暂无解析

  • 第6题:

    多选题
    1. public class OuterClass {  2. private double d1 = 1.0;  3. // insert code here  4. }  Which two are valid if inserted at line 3?()
    A

    static class InnerOne { public double methoda() { return d1; } }

    B

    static class InnerOne { static double methoda() { return d1; } }

    C

    private class InnerOne { public double methoda() { return d1; } }

    D

    protected class InnerOne { static double methoda() { return d1; } }

    E

    public abstract class InnerOne { public abstract double methoda(); }


    正确答案: C,A
    解析: 暂无解析

  • 第7题:

    单选题
    int x=0;  int y 10;  do {  y--;  ++x;  } while (x < 5);  System.out.print(x + “,“ + y);  What is the result?()
    A

     5,6

    B

     5,5

    C

     6,5

    D

     6,6


    正确答案: B
    解析: 暂无解析

  • 第8题:

    单选题
    import java.util.*;  class KeyMaster {  public int i;  public KeyMaster(int i) { this.i = i; }  public boolean equals(Object o) { return i == ((KeyMaster)o).i; }  public int hashCode() { return i; }  }  public class MapIt {  public static void main(String[] args) {  Set set = new HashSet();  KeyMaster k1 = new KeyMaster(1);  KeyMaster k2 = new KeyMaster(2);  set.add(k1); set.add(k1);  set.add(k2); set.add(k2);  System.out.print(set.size() + “:”);  k2.i = 1;  System.out.print(set.size() + “:”);  set.remove(k1);  System.out.print(set.size() + “:”);  set.remove(k2);  System.out.print(set.size()); }  }  What is the result?()
    A

     4:4:2:2

    B

     4:4:3:2

    C

     2:2:1:0

    D

     2:2:0:0

    E

     2:1:0:0

    F

     2:2:1:1

    G

     4:3:2:1


    正确答案: A
    解析: 暂无解析

  • 第9题:

    多选题
    Which two CANNOT directly cause a thread to stop executing? ()
    A

    Calling the yield method.

    B

    Calling the wait method on an object.

    C

    Calling the notify method on an object.

    D

    Calling the notifyAll method on an object.

    E

    Calling the start method on another Thread object.


    正确答案: C,B
    解析: 暂无解析

  • 第10题:

    单选题
    Which statement is true?()
    A

     If only one thread is blocked in the wait method of an object, and another thread executes the modify on that same object, then the first thread immediately resumes execution.

    B

     If a thread is blocked in the wait method of an object, and another thread executes the notify method on the same object, it is still possible that the first thread might never resume execution.

    C

     If a thread is blocked in the wait method of an object, and another thread executes the notify method on the same object, then the first thread definitely resumes execution as a direct and sole  consequence of the notify call.

    D

     If two threads are blocked in the wait method of one object, and another thread executes the notify method on the same object, then the first thread that executed the wait call first definitely resumes execution as a direct and sole consequence of the notify call.


    正确答案: C
    解析: 暂无解析

  • 第11题:

    多选题
    Given that c is a reference to a valid java.io.Console object, which two code fragments read a line of text from the console?()
    A

    String s = c.readLine();

    B

    char[ ] c = c.readLine();

    C

    String s = c.readConsole();

    D

    char[ ] c = c.readConsole();

    E

    String s = c.readLine(%s, name );

    F

    char[ ] c = c.readLine(%s, name );


    正确答案: B,D
    解析: 暂无解析

  • 第12题:

    单选题
    System.out.format(”Pi is approximately %d.”, Math.PI);  What is the result?()
    A

     Compilation fails.

    B

     Pi is approximately 3.

    C

     Pi is approximately 3.141593.

    D

     An exception is thrown at runtime.


    正确答案: A
    解析: 暂无解析

  • 第13题:

    单选题
    Which statements concerning the effect of the statement gfx.drawRect(5, 5, 10, 10) are true, given that gfx is a reference to a valid Graphics object?()
    A

    The rectangle drawn will have a total width of 5 pixels.

    B

    The rectangle drawn will have a total height of 6 pixels.

    C

    The rectangle drawn will have a total width of 10 pixels.

    D

    The rectangle drawn will have a total height of 11 pixels.


    正确答案: D
    解析: 暂无解析

  • 第14题:

    单选题
    Which methods from the String and StringBuffer classes modify the object on which they are called?()
    A

    The charAt() method of the String class.

    B

    The toUpperCase() method of the String class.

    C

    The replace() method of the String class.

    D

    The reverse() method of the StringBuffer class.

    E

    The length() method of the StringBuffer class.


    正确答案: A
    解析: 暂无解析

  • 第15题:

    单选题
    public class X implements Runnable(    private int x;   private int y;   public static void main(Stringargs)  X that = new X();   (new Thread(that)).start();  (new Thread(that)).start();  )  public void run() (  for (;;) (  x++;   y++;   System.out.printIn(“x=” + x + “, y = ” + y);   )   )   What is the result?()
    A

     Errors at lines 7 and 8 cause compilation to fail.

    B

     The program prints pairs of values for x and y that might not always be the same on the same line  (for example, “x=2, y=1”).

    C

     The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears twice (for example, “x=1, y=1” followed by  “x=1, y=1”).

    D

     The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears only for once (for example, “x=1, y=1”  followed by “x=2, y=2”).


    正确答案: A
    解析: 暂无解析

  • 第16题:

    单选题
    What will be written to the standard output when the following program is run?()   public class Q8499 {   public static void main(String args[]) {  double d = -2.9;   int i = (int) d;  i *= (int) Math.ceil(d);  i *= (int) Math.abs(d);   System.out.println(i);   }   }
    A

    12

    B

    18

    C

    8

    D

    9

    E

    27


    正确答案: D
    解析: 暂无解析

  • 第17题:

    单选题
    public class X {   public static void main (Stringargs) {   String s1 = new String (“true”);   Boolean b1 = new Boolean (true);   if (s2.equals(b1)) {   System.out.printIn(“Equal”);   }   }   }   What is the result? ()
    A

     The program runs and prints nothing.

    B

     The program runs and prints “Equal”

    C

     An error at line 5 causes compilation to fail.

    D

     The program runs but aborts with an exception.


    正确答案: A
    解析: 暂无解析

  • 第18题:

    单选题
    public class Score implements Comparable {  private int wins, losses;  public Score(int w, int 1) { wins = w; losses = 1; }  public int getWins() { return wins; }  public int getLosses() { return losses; }  public String toString() {  return “”; }  // insert code here  }  Which method will complete this class?()
    A

     public int compareTo(Object o) {/*mode code here*/}

    B

     public int compareTo(Score other) {/*more code here*/}

    C

     public int compare(Score s1,Score s2){/*more code here*/}

    D

     public int compare(Object o1,Object o2){/*more code here*/}


    正确答案: B
    解析: 暂无解析

  • 第19题:

    多选题
    public class MethodOver {   public void setVar (int a, int b, float c) {   }   }   Which two overload the setVar method?()
    A

    Private void setVar (int a, float c, int b) {}

    B

    Protected void setVar (int a, int b, float c) {}

    C

    Public int setVar (int a, float c, int b) (return a;)

    D

    Public int setVar (int a, int b, float c) (return a;)

    E

    Protected float setVar (int a, int b, float c) (return c;)


    正确答案: A,E
    解析: 暂无解析

  • 第20题:

    多选题
    public class OuterClass {  private double d1  1.0;  //insert code here   }   You need to insert an inner class declaration at line2. Which two inner class declarations are valid?()
    A

    static class InnerOne {  public double methoda() {return d1;}  }

    B

    static class InnerOne {  static double methoda() {return d1;} }

    C

    private class InnerOne {  public double methoda() {return d1;} }

    D

    protected class InnerOne {  static double methoda() {return d1;} }

    E

    public abstract class InnerOne {  public abstract double methoda();  }


    正确答案: B,D
    解析: 暂无解析

  • 第21题:

    多选题
    Which two statements are true regarding the creation of a default constructor? ()
    A

    The default constructor initializes method variables.

    B

    The compiler always creates a default constructor for every class.

    C

    The default constructor invokes the no-parameter constructor of the superclass.

    D

    The default constructor initializes the instance variables declared in the class.

    E

    When a class has only constructors with parameters, the compiler does not create a default  constructor.


    正确答案: B,E
    解析: 暂无解析

  • 第22题:

    单选题
    Which code determines the int value foo closest to a double value bar?()
    A

     Int foo = (int) Math.max(bar);

    B

     Int foo = (int) Math.min(bar);

    C

     Int foo = (int) Math.abs(bar);

    D

     Int foo = (int) Math.ceil(bar);

    E

     Int foo = (int) Math.floor(bar);

    F

     Int foo = (int) Math.round(bar);


    正确答案: D
    解析: 暂无解析

  • 第23题:

    单选题
    import java.awt.*;   public class Test extends Frame {   public Test() {   add(new Label(“Hello”) );   add(new TextField(“Hello”) );   add(new Button(“Hello”) );   pack();   show();    }   public static void main(String args) {   new Test ();   }   }   What is the result? ()
    A

     The code will not compile.

    B

     A Window will appear containing only a Button.

    C

     An IllegalArgumentException is thrown at line 6.

    D

     A Window button will appear but will not contain the Label, TextField, or Button.

    E

     A Window will appear containing a Label at the top, a TextField below the Label, and a Button  below the TextField.

    F

     A Window will appear containing a Label on the left, a TextField to the right of the Label, and a button to the right of the TextField.


    正确答案: B
    解析: 暂无解析

  • 第24题:

    单选题
    public class Foo implements Runnable (  public void run (Thread t) {  system.out.printIn(“Running.”);  }  public static void main (String[] args)  {  new thread (new Foo()).start();  } )   What is the result?()
    A

     An exception is thrown.

    B

     The program exists without printing anything.

    C

     An error at line 1 causes compilation to fail.

    D

     An error at line 2 causes the compilation to fail.

    E

     “Running” is printed and the program exits.


    正确答案: A
    解析: 暂无解析