多选题Given:   12. NumberFormat nf = NumberFormat.getInstance();   13. nf.setMaximumFractionDigits(4);   14. nf.setMinimumFractionDigits(2);   15. String a = nf.format(3.1415926);   16. String b = nf.format(2);   Which two statements are true about the resul

题目
多选题
Given:   12. NumberFormat nf = NumberFormat.getInstance();   13. nf.setMaximumFractionDigits(4);   14. nf.setMinimumFractionDigits(2);   15. String a = nf.format(3.1415926);   16. String b = nf.format(2);   Which two statements are true about the result if the default locale is Locale.US?()
A

The value of b is 2.00.

B

The value of a is 3.141.

C

The value of a is 3.14.

D

The value of b is 2.0000.

E

The value of a is 3.1415.

F

The value of a is 3.1416.

G

The value of b is 2.


相似考题
参考答案和解析
正确答案: B,F
解析: 暂无解析
更多“多选题Given:   12. NumberFormat nf = NumberFormat.getInstance();   13. nf.setMaximumFractionDigits(4);   14. nf.setMinimumFractionDigits(2);   15. String a = nf.format(3.1415926);   16. String b = nf.format(2);   Which two statements are true about the resul”相关问题
  • 第1题:

    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”);

    正确答案:D,E

  • 第2题:

    11. public void testIfA() {  12. if(testIfB(”True”)) {  13. System.out.println(”True”);  14. } else {  15. System.out.println(”Not true”);  16. }  17. }  18. public Boolean testIfB(String str) {  19. return Boolean.valueOf(str);  20. }  What is the result when method testIfA is invoked?() 

    • A、 True
    • B、 Not true
    • C、 An exception is thrown at runtime.
    • D、 Compilation fails because of an error at line 12.
    • E、 Compilation fails because of an error at line 19.

    正确答案:A

  • 第3题:

    11. class Animal { public String noise() { return “peep”; } }  12. class Dog extends Animal {  13. public String noise() { return “bark”; }  14. }  15. class Cat extends Animal {  16. public String noise() { return “meow”; }  17. }  .....  30. Animal animal = new Dog();  31. Cat cat = (Cat)animal;  32. System.out.printIn(cat.noise());  What is the result?() 

    • A、 peep
    • B、 bark
    • C、 meow
    • D、 Compilation fails.
    • E、 An exception is thrown at runtime.

    正确答案:E

  • 第4题:

    1. class A {  3. public String to String() {  4. return “4”;  5. }  6. }  7. class B extends A {  8. public String toString() { 9. return super.toString() + “3”;  10. }  11. }  12. public class Test {  13. public static void main (String[] args) {  14. System.out.printIn(new B()); 15. }  16. }   What is the result( )?  

    • A、 Compilation succeeds and 4 is printed.
    • B、 Compilation …………… is printed.
    • C、 An error on line 9 cause compilation to fail.
    • D、 An error on line 14 cause compilation to fail.
    • E、 Compilation succeeds but an exception is thrown at line 9.

    正确答案:B

  • 第5题:

    10. public class MyClass {  11.  12. public Integer startingI;  13. public void methodA() {  14. Integer i = new Integer(25);  15. startingI = i;  16. methodB(i);  17. }  18. private void methodB(Integer i2) {  19. i2 = i2.intValue();  20.  21. }  22. }  If methodA is invoked, which two are true at line 20?()

    • A、 i2 == startingI returns true.
    • B、 i2 == startingI returns false.
    • C、 i2.equals(startingI) returns true.
    • D、 i2.equals(startingI) returns false.

    正确答案:B,C

  • 第6题:

    Given: 11.double input = 314159.26; 12.NumberFormat nf = NumberFormat.getInstance(Locale.ITALIAN); 13.String b; 14.//insert code here Which code, inserted at line 14, sets the value of b to 314.159,26?()

    • A、b = nf.parse( input );
    • B、b = nf.format( input );
    • C、b = nf.equals( input );
    • D、b = nf.parseObject( input );

    正确答案:B

  • 第7题:

    多选题
    Given:   11. // insert code here   12. private N min, max;   13. public N getMin() { return min; }   14. public N getMax() { return max; }   15. public void add(N added) {   16. if (min == null || added.doubleValue()  max.doubleValue())  19. max = added;   20. }   21. }   Which two, inserted at line 11, will allow the code to compile?()
    A

    A

    B

    B

    C

    C

    D

    D

    E

    E

    F

    F


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

  • 第8题:

    单选题
    11. public void testIfA() {  12. if(testIfB(”True”)) {  13. System.out.println(”True”);  14. } else {  15. System.out.println(”Not true”);  16. }  17. }  18. public Boolean testIfB(String str) {  19. return Boolean.valueOf(str);  20. }  What is the result when method testIfA is invoked?()
    A

     True

    B

     Not true

    C

     An exception is thrown at runtime.

    D

     Compilation fails because of an error at line 12.

    E

     Compilation fails because of an error at line 19.


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

  • 第9题:

    单选题
    11. double input = 314159.26;  12. NumberFormat nf= NumberFormat.getInstance(Locale.ITALIAN);  13. String b;  14. //insert code here  Which code, inserted at line 14, sets the value of b to 3 14.159,26?()
    A

     b = nf.parse( input);

    B

     b = nf.format( input);

    C

     b = nf.equals( input);

    D

     b = nf.parseObject( input);


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

  • 第10题:

    单选题
    11. class Animal { public String noise() { return “peep”; } }  12. class Dog extends Animal {  13. public String noise() { return “bark”; }  14. }  15. class Cat extends Animal {  16. public String noise() { return “meow”; }  17. }  .....  30. Animal animal = new Dog();  31. Cat cat = (Cat)animal;  32. System.out.printIn(cat.noise());  What is the result?()
    A

     peep

    B

     bark

    C

     meow

    D

     Compilation fails.

    E

     An exception is thrown at runtime.


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

  • 第11题:

    多选题
    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”);


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

  • 第12题:

    多选题
    10. public class MyClass {  11.  12. public Integer startingI;  13. public void methodA() {  14. Integer i = new Integer(25);  15. startingI = i;  16. methodB(i);  17. }  18. private void methodB(Integer i2) {  19. i2 = i2.intValue();  20.  21. }  22. }  If methodA is invoked, which two are true at line 20?()
    A

    i2 == startingI returns true.

    B

    i2 == startingI returns false.

    C

    i2.equals(startingI) returns true.

    D

    i2.equals(startingI) returns false.


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

  • 第13题:

    1. class TestA {  2. TestB b;  3. TestA() {  4. b = new TestB(this);  5. }  6. }  7. class TestB {  8. TestA a;  9. TestB(TestA a) {  10. this.a = a;  11. }  12. }  13. class TestAll {  14. public static void main (String args[]) {  15. new TestAll().makeThings(); 16. // ...code continues on  17. }  18. void makeThings() {  19. TestA test = new TestA(); 20. }  21. }  Which two statements are true after line 15, before main completes?()

    • A、 Line 15 causes a stack overflow.
    • B、 An exception is thrown at runtime.
    • C、 The object referenced by a is eligible for garbage collection.
    • D、 The object referenced by b is eligible for garbage collection.
    • E、 The object referenced by a is not eligible for garbage collection.
    • F、 The object referenced by b is not eligible for garbage collection.

    正确答案:C,D

  • 第14题:

    11. class Converter {  12. public static void main(String[] args) {  13. Integer i = args[0];  14. int j = 12;  15. System.out.println(”It is “ + (j==i) + “that j==i.”);  16. }  17. }  What is the result when the programmer attempts to compile the code and run it with the command java Converter 12?() 

    • A、 It is true that j==i.
    • B、 It is false that j==i.
    • C、 An exception is thrown at runtime.
    • D、 Compilation fails because of an error in line 13.

    正确答案:D

  • 第15题:

    NumberFormat nf= NumberFormat.getInstance();  nf.setMaximumFractionDigits(4);  nf.setMinimumFractionDigits(2);  String a = nf.format(3.1415926);  String b = nf.format(2);  Which two are true about the result if the default locale is Locale.US?()

    • A、 The value of b is 2.
    • B、 The value of a is 3.14.
    • C、 The value of b is 2.00.
    • D、 The value of a is 3.141.
    • E、 The value of a is 3.1415.
    • F、 The value of a is 3.1416.
    • G、 The value of b is 2.0000.

    正确答案:C,F

  • 第16题:

    11. double input = 314159.26;  12. NumberFormat nf= NumberFormat.getInstance(Locale.ITALIAN);  13. String b;  14. //insert code here  Which code, inserted at line 14, sets the value of b to 3 14.159,26?() 

    • A、 b = nf.parse( input);
    • B、 b = nf.format( input);
    • C、 b = nf.equals( input);
    • D、 b = nf.parseObject( input);

    正确答案:B

  • 第17题:

    11. public static void test(String str) {  12. if(str == null | str.lellgth() == 0) {  13. System.out.println(”String is empty”);  14. } else {  15. System.out.println(”String is not empty”);  16. }  17. }  And the invocation:  31. test(llull);  What is the result?() 

    • A、 Au exception is thrown at runtime.
    • B、 “String is empty” is printed to output.
    • C、 Compilation fails because of au error in line 12.
    • D、 “String is not empty” is printed to output.

    正确答案:A

  • 第18题:

    Given:   12. NumberFormat nf = NumberFormat.getInstance();   13. nf.setMaximumFractionDigits(4);   14. nf.setMinimumFractionDigits(2);   15. String a = nf.format(3.1415926);   16. String b = nf.format(2);   Which two statements are true about the result if the default locale is Locale.US?()

    • A、 The value of b is 2.00.
    • B、 The value of a is 3.141.
    • C、 The value of a is 3.14.
    • D、 The value of b is 2.0000.
    • E、 The value of a is 3.1415.
    • F、 The value of a is 3.1416.
    • G、 The value of b is 2.

    正确答案:A,F

  • 第19题:

    单选题
    Given: 11.double input = 314159.26; 12.NumberFormat nf = NumberFormat.getInstance(Locale.ITALIAN); 13.String b; 14.//insert code here Which code, inserted at line 14, sets the value of b to 314.159,26?()
    A

    b = nf.parse( input );

    B

    b = nf.format( input );

    C

    b = nf.equals( input );

    D

    b = nf.parseObject( input );


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

  • 第20题:

    多选题
    1. class TestA {  2. TestB b;  3. TestA() {  4. b = new TestB(this);  5. }  6. }  7. class TestB {  8. TestA a;  9. TestB(TestA a) {  10. this.a = a;  11. }  12. }  13. class TestAll {  14. public static void main (String args[]) {  15. new TestAll().makeThings(); 16. // ...code continues on  17. }  18. void makeThings() {  19. TestA test = new TestA(); 20. }  21. }  Which two statements are true after line 15, before main completes?()
    A

    Line 15 causes a stack overflow.

    B

    An exception is thrown at runtime.

    C

    The object referenced by a is eligible for garbage collection.

    D

    The object referenced by b is eligible for garbage collection.

    E

    The object referenced by a is not eligible for garbage collection.

    F

    The object referenced by b is not eligible for garbage collection.


    正确答案: C,F
    解析: This is a typical example of the island of isolation. On line 15, the two objects TestA and TestB have a reference to one an other. Therefore, the correct answers are C. and D. A key point to remember is that an object that is referenced by another object can be eligible for garbage collection if the two objects form an island of isolated objects. 

  • 第21题:

    单选题
    Given:   11. public static void main(String[] args) {   12. Object obj = new int[] { 1, 2, 3 };   13. int[] someArray = (int[])obj;   14. for (int i : someArray) System.out.print(i + " ");   15. }   What is the result? ()
    A

     Compilation fails because of an error in line 13.

    B

     A ClassCastException is thrown at runtime.

    C

     1 2 3

    D

     Compilation fails because of an error in line 14.

    E

     Compilation fails because of an error in line 12.


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

  • 第22题:

    单选题
    Given: 11.double input = 314159.26; 12.NumberFormat nf = NumberFormat.getInstance(Locale.ITALIAN); 13.String b; 14.//insert code here Which code, inserted at line 14, sets the value of b to 314.159,26?()
    A

    b = nf.parse( input );

    B

    b = nf.format( input );

    C

    b = nf.equals( input );

    D

    b = nf.parseObject( input );


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

  • 第23题:

    多选题
    NumberFormat nf= NumberFormat.getInstance();  nf.setMaximumFractionDigits(4);  nf.setMinimumFractionDigits(2);  String a = nf.format(3.1415926);  String b = nf.format(2);  Which two are true about the result if the default locale is Locale.US?()
    A

    The value of b is 2.

    B

    The value of a is 3.14.

    C

    The value of b is 2.00.

    D

    The value of a is 3.141.

    E

    The value of a is 3.1415.

    F

    The value of a is 3.1416.

    G

    The value of b is 2.0000.


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