单选题void waitForSignal() {  Object obj = new Object();  synchronized (Thread.currentThread()) {  obj.wait();  obj.notify();  }  }  Which is true?()AThis code may throw an InterruptedException.BThis code may throw an IllegalStateException.CThis code may thr

题目
单选题
void waitForSignal() {  Object obj = new Object();  synchronized (Thread.currentThread()) {  obj.wait();  obj.notify();  }  }  Which is true?()
A

 This code may throw an InterruptedException.

B

 This code may throw an IllegalStateException.

C

 This code may throw a TimeoutException after ten minutes.

D

 This code will not compile unless “obj.wait()” is replaced with “((Thread) obj).wait()”.

E

 Reversing the order of obj.wait() and obj.notify() may cause this method to complete normally.

F

 A call to notify() or notifyAll() from another thread may cause this method to complete normally.


相似考题
更多“void waitForSignal() {  Object obj = new Object();  synchron”相关问题
  • 第1题:

    创建一个对象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

  • 第2题:

    void waitForSignal() {  Object obj = new Object();  synchronized (Thread.currentThread()) {  obj.wait();  obj.notify();  }  }  Which is true?() 

    • A、 This code may throw an InterruptedException.
    • B、 This code may throw an IllegalStateException.
    • C、 This code may throw a TimeoutException after ten minutes.
    • D、 This code will not compile unless “obj.wait()” is replaced with “((Thread) obj).wait()”.
    • E、 Reversing the order of obj.wait() and obj.notify() may cause this method to complete normally.
    • F、 A call to notify() or notifyAll() from another thread may cause this method to complete normally.

    正确答案:B

  • 第3题:

    在j2ee中,以下是firevetoablechange方法的正确的原型的是() 

    • A、public void fireVetoableChange(Object  oldValue,Object newValue)
    • B、 public void fireVetoableChange(String  propertyName,Object newValue)
    • C、 public void fireVetoableChange(String  propertyName, Object  oldValue ,Object newValue)throws PropertyVetoException
    • D、 public void fireVetoableChange(String  propertyName, Object  oldValue ,Object newValue)

    正确答案:C

  • 第4题:

    以下装箱、拆箱语句中,错误的有()

    • A、 object obj=100;  int m=(int)obj;
    • B、 object obj=100;  int m=obj;
    • C、 object obj=(int)100;  int m=(int)obj;
    • D、 object obj=(object)100;  int m=(int)obj;

    正确答案:B

  • 第5题:

    Given the following code fragment:     public void create() {     Vector myVect;     myVect = new Vector();      }  Which of the following statements are true?() 

    • A、 The declaration on line 2 does not allocate memory space for the variable myVect.
    • B、 The declaration on line 2 allocates memory space for a reference to a Vector object.
    • C、 The statement on line 2 creates an object of class Vector.
    • D、 The statement on line 3 creates an object of class Vector.
    • E、 The statement on line 3 allocates memory space for an object of class Vector.

    正确答案:A,D,E

  • 第6题:

    You are implementing an ASP.NET Web site. The site uses a component that must be dynamically configured before it can be used within site pages. You create a static method named SiteHelper.Configure that configures the component. You need to add a code segment to the Global.asax file that invokes the SiteHelper.Configure method the first time, and only the first time, that any page in the site is requested. Which code segment should you use? ()

    • A、void Application_Start(object sender, EventArgs e) { SiteHelper.Configure(); }
    • B、void Application_Init(object sender, EventArgs e) { SiteHelper.Configure(); }
    • C、void Application_BeginRequest(object sender, EventArgs e) { SiteHelper.Configure(); }
    • D、Object lockObject = new Object(); void Application_BeginRequest(object sender, EventArgs e) { lock(lockObject()) { SiteHelper.Configure(); } }

    正确答案:A

  • 第7题:

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

  • 第8题:

    单选题
    以下装箱、拆箱语句中,错误的有()
    A

     object obj=100;  int m=(int)obj;

    B

     object obj=100;  int m=obj;

    C

     object obj=(int)100;  int m=(int)obj;

    D

     object obj=(object)100;  int m=(int)obj;


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

  • 第9题:

    单选题
    void waitForSignal() {  Object obj = new Object();  synchronized (Thread.currentThread()) {  obj.wait();  obj.notify();  }  }  Which is true?()
    A

     This code may throw an InterruptedException.

    B

     This code may throw an IllegalStateException.

    C

     This code may throw a TimeoutException after ten minutes.

    D

     This code will not compile unless “obj.wait()” is replaced with “((Thread) obj).wait()”.

    E

     Reversing the order of obj.wait() and obj.notify() may cause this method to complete normally.

    F

     A call to notify() or notifyAll() from another thread may cause this method to complete normally.


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

  • 第10题:

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

    123

    B

    Compilation fails because of an error in line 12.

    C

    Compilation fails because of an error in line 13.

    D

    Compilation fails because of an error in line 14.

    E

    A ClassCastException is thrown at runtime.


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

  • 第11题:

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

  • 第12题:

    单选题
    创建一个对象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;}


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

  • 第13题:

    创建一个对象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

  • 第14题:

    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.

    正确答案:A

  • 第15题:

    在JAVA中,Object类是所有类的父亲,用户自定义类默认扩展自Object类,下列选项中的()方法不属于Object类的方法。

    • A、equals(Object obj)
    • B、getClass()
    • C、toString()
    • D、trim()

    正确答案:D

  • 第16题:

    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

  • 第17题:

    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 */ }

    正确答案:C,E,F

  • 第18题:

    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

  • 第19题:

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

  • 第20题:

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

  • 第21题:

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

  • 第22题:

    单选题
    在J2EE中,以下是firePropertyChange的原型,正确的是()。
    A

    public void firePropertyChange(PropertyChangeListener l,String oldValue, String newValue)

    B

    public void firePropertyChange(String propertyName, Object oldValue, Object newValue)

    C

    public void firePropertyChange(PropertyChangeSupport changes)

    D

    public void firePropertyChange(Object oldValue, Object newValue)


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

  • 第23题:

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


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

  • 第24题:

    单选题
    在j2ee中,以下是firevetoablechange方法的正确的原型的是()
    A

    public void fireVetoableChange(Object  oldValue,Object newValue)

    B

     public void fireVetoableChange(String  propertyName,Object newValue)

    C

     public void fireVetoableChange(String  propertyName, Object  oldValue ,Object newValue)throws PropertyVetoException

    D

     public void fireVetoableChange(String  propertyName, Object  oldValue ,Object newValue)


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