单选题Given: What is the result? ()AA new Item object is created with the preferred value in the id attribute.BThe attribute id in the Item object is modified to the new value.CCompilation fails.DAn exception is thrown at runtime.EThe attribute id in the Ite

题目
单选题
Given: What is the result? ()
A

 A new Item object is created with the preferred value in the id attribute.

B

 The attribute id in the Item object is modified to the new value.

C

 Compilation fails.

D

 An exception is thrown at runtime.

E

 The attribute id in the Item object remains unchanged.


相似考题
参考答案和解析
正确答案: E
解析: 暂无解析
更多“单选题Given: What is the result? ()A  A new Item object is created with the preferred value in the id attribute.B  The attribute id in the Item object is modified to the new value.C  Compilation fails.D  An exception is thrown at runtime.E  The attribut”相关问题
  • 第1题:

    Runnable r = new Runnable() {  public void run() {  System.out.print(”Cat”);  }  };  Threadt=new Thread(r) {  public void run() {  System.out.print(”Dog”);  }  };  t.start();  What is the result?() 

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

    正确答案:B

  • 第2题:

    12. Date date = new Date();  13. df.setLocale(Locale.ITALY);  14. String s = df.format(date);  The variable df is an object of type DateFormat that has been initialized in line 11. What is the result if this code is run on December 14, 2000?() 

    • A、 The value of s is 14-dic-2004.
    • B、 The value of s is Dec 14, 2000.
    • C、 An exception is thrown at runtime.
    • D、 Compilation fails because of an error in line 13.

    正确答案:D

  • 第3题:

    try {  if ((new Object))(.equals((new Object()))) {  System.out.println(“equal”);  }else{  System.out.println(“not equal”);  }  }catch (Exception e) {  System.out.println(“exception”);  }   What is the result? () 

    • A、 equal
    • B、 not equal
    • C、 exception
    • D、 Compilation fails.

    正确答案:D

  • 第4题:

    class Base {  Base() { System.out.print(“Base”); }  }  public class Alpha extends Base {  public static void main( String[] args ) {  new Alpha();  new Base();  }  }  What is the result?()  

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

    正确答案:B

  • 第5题:

    单选题
    Given: What is the result?()
    A

    collie

    B

    harrier

    C

    Compilation fails.

    D

    collie harrier

    E

    An exception is thrown at runtime.


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

  • 第6题:

    单选题
    Runnable r = new Runnable() {  public void run() {  System.out.print(”Cat”);  }  };  Threadt=new Thread(r) {  public void run() {  System.out.print(”Dog”);  }  };  t.start();  What is the result?()
    A

     Cat

    B

     Dog

    C

     Compilation fails.

    D

     The code runs with no output.

    E

     An exception is thrown at runtime.


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

  • 第7题:

    单选题
    public class Drink implements Comparable {  public String name;  public int compareTo(Object o) {  return 0;  }  }  and:  Drink one = new Drink();  Drink two = new Drink();  one.name= “Coffee”;  two.name= “Tea”;  TreeSet set = new TreeSet();  set.add(one);  set.add(two);  A programmer iterates over the TreeSet and prints the name of each Drink object. What is the result?()
    A

     Tea

    B

     Coffee

    C

     Coffee Tea

    D

     Compilation fails.

    E

     The code runs with no output.

    F

     An exception is thrown at runtime.


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

  • 第8题:

    单选题
    11. public static void main(String[] args) {  12. Object obj = new Object() {  13. public int hashCode() {  14. returns 42; 15. }  16. };  17. System.out.println(obj.hashCode());  18. }    What is the result? ()
    A

     42

    B

     An exception is thrown at runtime.

    C

     Compilation fails because of an error on line 12.

    D

     Compilation fails because of an error on line 16.

    E

     Compilation fails because of an error on line 17.


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

  • 第9题:

    单选题
    Click the Exhibit button.   Given: ClassA a = new ClassA();   a.methodA();   What is the result?()
    A

     The code runs with no output.

    B

     Compilation fails.

    C

     An exception is thrown at runtime.

    D

     ClassC is displayed.


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

  • 第10题:

    多选题
    Given that Thing is a class, how many objects and reference variables are created by the following code?()   Thing item, stuff;   item = new Thing();   Thing entity = new Thing();
    A

    One object is created

    B

    Two objects are created

    C

    Three objects are created

    D

    One reference variable is created

    E

    Two reference variables are created

    F

    Three reference variables are created.


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

  • 第11题:

    单选题
    Given: What is the result?()
    A

    Compilation fails.

    B

    exception is thrown at runtime.

    C

    The attribute id in the ItemTest object remains unchanged.

    D

    The attribute id in the ItemTest object is modified to the new value.

    E

    A new ItemTest object is created with the preferred value in the id attribute.


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

  • 第12题:

    单选题
    Given: What is the result?()
    A

    Hello

    B

    Hello World

    C

    Compilation fails.

    D

    Hello World 5

    E

    The code runs with no output.

    F

    An exception is thrown at runtime.


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

  • 第13题:

    Given that Thing is a class, how many objects and reference variables are created by the following code?()   Thing item, stuff;   item = new Thing();   Thing entity = new Thing();

    • A、One object is created
    • B、Two objects are created
    • C、Three objects are created
    • D、One reference variable is created
    • E、Two reference variables are created
    • F、Three reference variables are created.

    正确答案:B,F

  • 第14题:

    public class Drink implements Comparable {  public String name;  public int compareTo(Object o) {  return 0;  }  }  and:  Drink one = new Drink();  Drink two = new Drink();  one.name= “Coffee”;  two.name= “Tea”;  TreeSet set = new TreeSet();  set.add(one);  set.add(two);  A programmer iterates over the TreeSet and prints the name of each Drink object. What is the result?() 

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

    正确答案:B

  • 第15题:

    public class ClassA {  public int getValue() {  int value=0;  boolean setting = true;  String title=”Hello”;  (value || (setting && title == “Hello”)) { return 1; }  (value == 1 & title.equals(”Hello”)) { return 2; }  }  } And:  ClassA a = new ClassA();  a.getValue();  What is the result?() 

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

    正确答案:C

  • 第16题:

    Given: 12.Date date = new Date(); 13.df.setLocale(Locale.ITALY); 14.String s = df.format(date); The variable df is an object of type DateFormat that has been initialized in line 11. What is the result if this code is run on December 14, 2000?()

    • A、The value of s is 14-dic-2000.
    • B、The value of s is Dec 14, 2000.
    • C、An exception is thrown at runtime.
    • D、Compilation fails because of an error in line 13.

    正确答案:D

  • 第17题:

    单选题
    Given: What is the result?()
    A

    r, t, t,

    B

    r, e, o,

    C

    Compilation fails.

    D

    An exception is thrown at runtime.


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

  • 第18题:

    单选题
    Given: What is the result?()
    A

    TestA

    B

    TestB

    C

    Compilation fails.

    D

    An exception is thrown at runtime.


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

  • 第19题:

    单选题
    class Base {  Base() { System.out.print(“Base”); }  }  public class Alpha extends Base {  public static void main( String[] args ) {  new Alpha();  new Base();  }  }  What is the result?()
    A

     Base

    B

     BaseBase

    C

     Compilation fails.

    D

     The code runs with no output.

    E

     An exception is thrown at runtime.


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

  • 第20题:

    单选题
    Given: What is the result?()
    A

     An exception is thrown at runtime.

    B

     int Long

    C

     Compilation fails.

    D

     Short Long


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

  • 第21题:

    单选题
    public class ItemTest {  private final mt id;  public ItemTest(int id) { this.id = id; }  public void updateId(int newId) { id = newId; }  public static void main(String[] args) {  ItemTest fa = new ItemTest(42);  fa.updateId(69);  System.out.println(fa.id);  }  }  What is the result?()
    A

     Compilation fails.

    B

     An exception is thrown at runtime.

    C

     The attribute id in the Item object remains unchanged.

    D

     The attribute id in the Item object is modified to the new value.

    E

     A new Item object is created with the preferred value in the id attribute.


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

  • 第22题:

    单选题
    try {  if ((new Object))(.equals((new Object()))) {  System.out.println(“equal”);  }else{  System.out.println(“not equal”);  }  }catch (Exception e) {  System.out.println(“exception”);  }   What is the result? ()
    A

     equal

    B

     not equal

    C

     exception

    D

     Compilation fails.


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

  • 第23题:

    单选题
    public class ClassA {  public int getValue() {  int value=0;  boolean setting = true;  String title=”Hello”;  (value || (setting && title == “Hello”)) { return 1; }  (value == 1 & title.equals(”Hello”)) { return 2; }  }  } And:  ClassA a = new ClassA();  a.getValue();  What is the result?()
    A

     1

    B

     2

    C

     Compilation fails.

    D

     The code runs with no output.

    E

     An exception is thrown at runtime.


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