单选题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? ()AequalBnot equalCexceptionDCompilation f

题目
单选题
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.


相似考题
更多“try {  if ((new Object))(.equals((new Object()))) {  System.”相关问题
  • 第1题:

    当执行下面代码时,会输出( )。 Boolean b1 = new Boolean(true); Boolean b2 = new Boolean(true); if (b1 == b2) if (bi.equals(b2)) System. out.printin ("a"); else System. out. println ("b"); else if (bi.equals(b2)) System. out.println ("c"); else System. out.printIn("d");

    A.a

    B.b

    C.c

    D.d


    正确答案:C
    解析:本题考查对简单类型中的boolean类型的类封装的理解和掌握。对应于基本数据类型boolean的类封装是Boolean。它的构造函数的原型是Boalean(boolean value),将boolean值的数据转换为Boolean的对象。成员函数 equals()的原型是Boolean equals(Object Obj),当且仅当obj对象为Boolean对象且它的布尔值与该对象的布尔值相同时返回true。注意关系运算符==用来比较两个操作数的值是否相等。它一般只能用在基本数据类型间的比较,对于复杂的数据类型,这种比较往往都是没有意义的,对于这种没有意义的比较,其结果都为false。在本题的代码中,先创建两个Boolean类的对象b1和b2,并且它们的布尔值都为 true。然后直接对这两个对象进行==关系运算,这样的运算结果肯定为false,程序流程就走到第1层的else语句那里了,然后再用equals函数对两个对象的布尔值进行比较。因为它们的布尔值都为true,所以返回结果为true。这样输出的结果就为C。

  • 第2题:

    创建一个对象obj,该对象包含一个名为"name"的属性,其值为"value"。以下哪一段JavaScript代码无法得到上述的结果?()

    • A、var obj=new Object();obj["name"]="value";
    • B、var obj=new Object();obj.prototype.name="value";
    • C、var obj={name:"value"};
    • D、var obj=new function(){this.name="value";}

    正确答案:B

  • 第3题:

    10. public Object m() { 11. Object o = new Float(3.14F); 12. Object [] oa = new Object[1]; 13. oa[0] = o; 14. o = null; 15. return oa[0]; 16. } When is the Float object, created in line 11, eligible for garbage collection?()  

    • A、 Just after line 13.
    • B、 Just after line 14.
    • C、 Never in this method.
    • D、 Just after line 15 (that is, as the method returns).

    正确答案:C

  • 第4题:

    String s=new String("xyz");创建了几个String Object?


    正确答案: 两个或一个,”xyz”对应一个对象,这个对象放在字符串常量缓冲区,常量”xyz”不管出现多少遍,都是缓冲区中的那一个。New String每写一遍,就创建一个新的对象,它一句那个常量”xyz”对象的内容来创建出一个新String对象。如果以前就用过’xyz’,这句代表就不会创建”xyz”自己了,直接从缓冲区拿。

  • 第5题:

    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

  • 第6题:

    You are developing an application to create a new file on the local file system.You need to define specific security settings for the file. You must deny the file inheritance of any default security settings during creation.What should you do?()

    • A、Create the file by using a new FileStream object by passing the FileSecurity object as a parameter to the FileStream constructor.
    • B、Create a new FileSecurity object.
    • C、Apply the permissions by using the File class.
    • D、Create a new FileSystem Access Rule object for each permission that you need,and add each rule to the FileSecurity object.
    • E、Create a new FileSystem Audit Rule object and add it to the FileSecurity object.

    正确答案:A,B,D

  • 第7题:

    单选题
    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.


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

  • 第8题:

    单选题
    You need to design a software usage policy for the employees of Southbridge Video. The policy must meet business requirements. What should you do?()
    A

    Configure the software restriction policy in the Default Domain Policy Group Policy object (GPO)

    B

    Create a new connection object by using the Connection Manager Administration Kit (CMAK), and install the new connection object on all client computers

    C

    Create and configure a local security policy on both of the ISA server computers

    D

    Configure the Internet Explorer settings in the Default Domain Policy Group Policy object (GPO)


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

  • 第9题:

    多选题
    You are developing an application to create a new file on the local file system.You need to define specific security settings for the file. You must deny the file inheritance of any default security settings during creation.What should you do?()
    A

    Create the file by using a new FileStream object by passing the FileSecurity object as a parameter to the FileStream constructor.

    B

    Create a new FileSecurity object.

    C

    Apply the permissions by using the File class.

    D

    Create a new FileSystem Access Rule object for each permission that you need,and add each rule to the FileSecurity object.

    E

    Create a new FileSystem Audit Rule object and add it to the FileSecurity object.


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

  • 第10题:

    单选题
    public class X {  public object m () {   object o = new float (3.14F);   object oa = new object [1];   oa[0]= o;   o = null;   return oa[0];   }   }   When is the float object created in line 3, eligible for garbage collection?()
    A

     Just after line 5

    B

     Just after line 6

    C

     Just after line 7 (that is, as the method returns)

    D

     Never in this method.


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

  • 第11题:

    单选题
    You want to use te Coherence Java APIs to directly cached POJOs. Consider this snippet of code: NamedCache cache - CacheFactory.getCache("mycache");  cache.put(new Integer(I)f "hello"); cache.put(T,"hi");  cache.put(new Long(II),"hey");  This code inserts three objects into the cache.  Why ?()
    A

     hashCode() and equals() method for each object type is different so a different key is used

    B

     each object value string is different so a different value is inserted on each put

    C

     equals() and compare() method is different for each put

    D

     POF need to be implemented for this to work properly


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

  • 第12题:

    多选题
    Which three will compile and run without exception?()
    A

    private synchronized Object o;

    B

    void go(){   synchronized(){/* code here */}

    C

    public synchronized void go(){/* code here */}

    D

    private synchronized(this) void go(){/* code here */}

    E

    void go(){   synchronized(Object.class){/* code here */}

    F

    void go(){   Object o = new Object();   synchronized(o){/* code here */}


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

  • 第13题:

    public class X {  public object m () {   object o = new float (3.14F);   object oa = new object [1];   oa[0]= o;   o = null;   return oa[0];   }   }   When is the float object created in line 3, eligible for garbage collection?()

    • A、 Just after line 5
    • B、 Just after line 6
    • C、 Just after line 7 (that is, as the method returns)
    • D、 Never in this method.

    正确答案:D

  • 第14题:

    class Sock2 {   String color;   public boolean equals(Object o) {   return color.equals(((Sock2)o).color);   } }   class TestSocks {   public static void main(String [] args) {   Sock2 s1 = new Sock2(); s1.color = "blue";   Sock2 s2 = new Sock2(); s2.color = "blue";   if (s1.equals(s2)) System.out.print("equals ");   if (s1 == s2) System.out.print("== ");   }   }   结果为:()      

    • A、==
    • B、equals
    • C、equals ==
    • D、无结果输出

    正确答案:B

  • 第15题:

    欲构造ArrayList类的一个实例,此类继承了List接口,下列哪个方法是正确的?()

    • A、 ArrayList myList=new Object();
    • B、 List myList=new ArrayList();
    • C、 ArrayList myList=new List();
    • D、 List myList=new List();

    正确答案:B

  • 第16题:

    1. public class X (  2. public object m ()  {  3. object o = new float (3.14F);  4. object [] oa = new object [1];  5. oa[0]= o;  6. o = null;  7. return oa[0];  8. }  9. }   When is the float object created in line 3, eligible for garbage collection?()  

    • A、 Just after line 5
    • B、 Just after line 6
    • C、 Just after line 7 (that is, as the method returns)
    • D、 Never in this method.

    正确答案:D

  • 第17题:

    You are the network administrator for The network consists of a single Active Directory domain named All network servers run Windows Server 2003. A member server named TK1 contains a large number of files that are frequently accessed by network users. Users report unacceptable response times on TK1. You compare the current performance of TK1 to a system performance baseline that you created several weeks ago. You decide that TK1 needs a higher-performance network adapter. After you add the appropriate network adapter, users report satisfactory performance. You need to gather new server performance data so you can establish a new performance baseline for TK1. You open the Performance console. What should you do next?()

    • A、Add all counters for the Network Interface object to the System Monitor object.
    • B、Create a new trace log object. Under Events logged by system provider in the new object, select the Network TCP/IP setting. Start the trace log.
    • C、Create a new counter log object. Add all counters for the Network Interface object to the new object. Start the counter.
    • D、Create a new alert object.

    正确答案:C

  • 第18题:

    单选题
    public class X {   public object m () {   object o = new float (3.14F);   object oa = new object [1];   oa[0]= o;   o = null;   oa[0] = null;   return o;   }   }   When is the float object created in line 3, eligible for garbage collection?()
    A

     Just after line 5.

    B

     Just after line 6.

    C

     Just after line 7.

    D

     Just after line 8(that is, as the method returns).


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

  • 第19题:

    单选题
    1.public class GC{ 2.private Objec to; 3.private void doSomethingElse(Object obj){o=obj;} 4.public void doSomething(){ 5.Object o=new Object(); 6.doSomethingElse(o); 7.o=new Object(); 8.doSomethingElse(null); 9.o=null; 10.} 11.} When the doSomething method is called,after which line does the Object created in line 5 become available for garbage collection?()
    A

    Line5

    B

    Line6

    C

    Line7

    D

    Line8

    E

    Line9

    F

    Line10


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

  • 第20题:

    问答题
    String s = new String("xyz");创建了几个String Object?

    正确答案: 两个对象,一个是“xyx”,一个是指向“xyx”的引用对象s。
    解析: 暂无解析

  • 第21题:

    单选题
    1. public class X (  2. public object m ()  {  3. object o = new float (3.14F);  4. object [] oa = new object [1];  5. oa[0]= o;  6. o = null;  7. return oa[0];  8. }  9. }   When is the float object created in line 3, eligible for garbage collection?()
    A

     Just after line 5

    B

     Just after line 6

    C

     Just after line 7 (that is, as the method returns)

    D

     Never in this method.


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

  • 第22题:

    单选题
    class Sock2 {   String color;   public boolean equals(Object o) {   return color.equals(((Sock2)o).color);   } }   class TestSocks {   public static void main(String [] args) {   Sock2 s1 = new Sock2(); s1.color = "blue";   Sock2 s2 = new Sock2(); s2.color = "blue";   if (s1.equals(s2)) System.out.print("equals ");   if (s1 == s2) System.out.print("== ");   }   }   结果为:()
    A

    ==

    B

    equals

    C

    equals ==

    D

    无结果输出


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

  • 第23题:

    单选题
    1. public class GC {  2. private Object o;  3. private void doSomethingElse(Object obj) { o = obj; }  4. public void doSomething() {  5. Object o = new Object();  6. doSomethingElse(o);  7. o = new Object();  8. doSomethingElse(null);  9.o=null;  10. }  11. }  When the doSomething method is called, after which line does the Object created in line 5 become available for garbage collection?()
    A

     Line 5

    B

     Line 6

    C

     Line 7

    D

     Line 8

    E

     Line 9

    F

     Line 10


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

  • 第24题:

    单选题
    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
    解析: 暂无解析