多选题Which three changes should be made to adapt this class to be used safely by multiple threads?()Adeclare reset() using the synchronized keywordBdeclare getName() using the synchronized keywordCdeclare getCount() using the synchronized keywordDdeclare the constructor using the synchronized keywordEdeclare increment() using the synchronized keyword

多选题
Which three changes should be made to adapt this class to be used safely by multiple threads?()
A

declare reset() using the synchronized keyword

B

declare getName() using the synchronized keyword

C

declare getCount() using the synchronized keyword

D

declare the constructor using the synchronized keyword

E

declare increment() using the synchronized keyword


参考解析

解析: 暂无解析

相关考题:

Whichthreewillcompileandrunwithoutexception?() A.privatesynchronizedObjecto;B.voidgo(){synchronized(){/*codehere*/}C.publicsynchronizedvoidgo(){/*codehere*/}D.privatesynchronized(this)voidgo(){/*codehere*/}E.voidgo(){synchronized(Object.class){/*codehere*/}F.voidgo(){Objecto=newObject();synchronized(o){/*codehere*/}

Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object?() A.When using versions of Java technology earlier than 5.0.B.When sharing a StringBuffer among multiple threads.C.When using the java.io class StringBufferInputStream.D.When you plan to reuse the StringBuffer to build more than one string.

Given:Which two changes, taken together, would guarantee the output: 1, 2, 3, 4, 5, ?() A.move the line 12 print statement into the foo() methodB.change line 7 to public synchronized void go() {C.change the variable declaration on line 2 to private volatile int x;D.wrap the code inside the foo() method with a synchronized( this ) blockE.wrap the for loop code inside the go() method with a synchronized block synchronized(this){ //for loop code here }

public class SyncTest {  private int x;  private int y;  private synchronized void setX( int i ) { x = i; }  private synchronized void setY( int i ) { y = i; }  public void setXY( int i ) { setX(i); setY(i); }  public synchronized boolean check() { return x != y; }  }   Under which condition will check return true when called from a different class? () A、 check can never return true.B、 check can return true when setXY is called by multiple threads.C、 check can return true when multiple threads call setX and setY separately.D、 check can return true only if SyncTest is changed to allow x and y to be set separately.

Which of the following commands should be used to assure that a dump can be forced using the reset button on a system without a key switch?()A、sysdumpdev -k B、sysdumpdev -L C、sysdumpdev -K D、sysdumpdev -P

Due to a recent change in government regulations, Company.com needs to create two  independent but synchronized copies of their data. These copies must be contained in separate storage device a minimum of 100 km apart. The customer has capacity in two systems that meet the criteria, one with SSA disk and the other is FAStT.  What facility can be used to manage this issue?()A、 Two independent copies of the data can be created and synchronized using the "HACMP/XD://HAGeo"B、 The existing disks can be incorporated a single storage unit using the optional product "HACMP/XD://PPRC"C、 AIX can create a mirrored logical volume across the two systems that would be accessible from either systemD、 AIX can use the multi path IO subsystem to spread the information across the devices and keep the copies separated

Which statement is true for the class java.util.ArrayList?()  A、 The elements in the collection are ordered.B、 The collection is guaranteed to be immutable.C、 The elements in the collection are guaranteed to be unique.D、 The elements in the collection are accessed using a unique key.E、 The elements in the collections are guaranteed to be synchronized.

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

public class NamedCounter {  private final String name;  private int count;  public NamedCounter(String name) { this.name = name; }  public String getName() { return name; }  public void increment() { coount++; }  public int getCount() { return count; } public void reset() { count = 0; } }  Which three changes should be made to adapt this class to be used safely by multiple threads? ()A、 declare reset() using the synchronized keywordB、 declare getName() using the synchronized keywordC、 declare getCount() using the synchronized keywordD、 declare the constructor using the synchronized keywordE、 declare increment() using the synchronized keyword

public class SyncTest {  private int x;  private int y;  public synchronized void setX (int i) (x=1;)  public synchronized void setY (int i) (y=1;)  public synchronized void setXY(int 1)(set X(i); setY(i);)  public synchronized Boolean check() (return x !=y;)  }  Under which conditions will check () return true when called from a different class?A、 Check() can never return true.B、 Check() can return true when setXY is called by multiple threads.C、 Check() can return true when multiple threads call setX and setY separately.D、 Check() can only return true if SyncTest is changed to allow x and y to be set separately.

public class TestFive {  private int x;  public void foo() {  int current = x;  x = current + 1;  }  public void go() {  for(int i=0;i5;i++) {  new Thread() {  public void run() {  foo();  System.out.print(x + “, “);  } }.start();  }}}  Which two changes, taken together, would guarantee the output: 1, 2, 3, 4, 5, ?()A、 Move the line 12 print statement into the foo() method.B、 Change line 7 to public synchronized void go() {.C、 Change the variable declaration on line 3 to private volatile int x;.D、 Wrap the code inside the foo() method with a synchronized( this ) block.E、 Wrap the for loop code inside the go() method with a synchronized block synchronized(this) { // for loop code here }.

Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object?()A、When using versions of Java technology earlier than 5.0.B、When sharing a StringBuffer among multiple threads.C、When using the java.io class StringBufferInputStream.D、When you plan to reuse the StringBuffer to build more than one string.

Which two statements are true?()A、It is possible for more than two threads to deadlock at once.B、The JVM implementation guarantees that multiple threads cannot enter into a deadlocked state.C、Deadlocked threads release once their sleep() method’s sleep duration has expired.D、Deadlocking can occur only when the wait(), notify(), and notifyAll() methods are used incorrectly.E、It is possible for a single-threaded application to deadlock if synchronized blocks are used incorrectly.F、If a piece of code is capable of deadlocking, you cannot eliminate the possibility ofdeadlocking by insertinginvocations of Thread.yield().

Which two statements are true?()A、It is possible for more than two threads to deadlock at once.B、The JVM implementation guarantees that multiple threads cannot enter into a deadlocked state.C、Deadlocked threads release once their sleep() method's sleep duration has expired.D、Deadlocking can occur only when the wait(), notify(), and notifyAll() methods are used incorrectly.E、It is possible for a single-threaded application to deadlock if synchronized blocks are used incorrectly.F、If a piece of code is capable of deadlocking, you cannot eliminate the possibility of deadlocking by inserting invocations of Thread.yield().

多选题public class NamedCounter {  private final String name;  private int count;  public NamedCounter(String name) { this.name = name; }  public String getName() { return name; }  public void increment() { coount++; }  public int getCount() { return count; } public void reset() { count = 0; } }  Which three changes should be made to adapt this class to be used safely by multiple threads? ()Adeclare reset() using the synchronized keywordBdeclare getName() using the synchronized keywordCdeclare getCount() using the synchronized keywordDdeclare the constructor using the synchronized keywordEdeclare increment() using the synchronized keyword

多选题Which three will compile and run without exception?()Aprivate synchronized Object o;Bvoid go() {synchronized() { /* code here */ }Cpublic synchronized void go() { /* code here */ }Dprivate synchronized(this) void go() { /* code here */ }Evoid go() {synchronized(Object.class) { /* code here */ }Fvoid go() {Object o = new Object();synchronized(o) { /* code here */ }

多选题Which two statements are true?()AIt is possible for more than two threads to deadlock at once.BThe JVM implementation guarantees that multiple threads cannot enter into a deadlocked state.CDeadlocked threads release once their sleep() method's sleep duration has expired.DDeadlocking can occur only when the wait(), notify(), and notifyAll() methods are used incorrectly.EIt is possible for a single-threaded application to deadlock if synchronized blocks are used incorrectly.FIf a piece of code is capable of deadlocking, you cannot eliminate the possibility of deadlocking by inserting invocations of Thread.yield().

多选题What two things happen when the CRS Publisher Database on an HRDB expansion server fails?()AAll call processing immediately begins using the CRS Subscriber Database.BCalls in queue are dropped.CAgent calls are dropped.DAgents are automatically logged out.ECRS configuration changes are blocked until the CRS Publisher Database is restored and synchronized with the CRS Subscriber Database.FConfiguration changes are buffered until the CRS Publisher Database is restored.

多选题Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object?()AWhen using versions of Java technology earlier than 5.0.BWhen sharing a StringBuffer among multiple threads.CWhen using the java.io class StringBufferInputStream.DWhen you plan to reuse the StringBuffer to build more than one string.

多选题public class TestFive {  private int x;  public void foo() {  int current = x;  x = current + 1;  }  public void go() {  for(int i=0;i5;i++) {  new Thread() {  public void run() {  foo();  System.out.print(x + “, “);  } }.start();  }}}  Which two changes, taken together, would guarantee the output: 1, 2, 3, 4, 5, ?()AMove the line 12 print statement into the foo() method.BChange line 7 to public synchronized void go() {.CChange the variable declaration on line 3 to private volatile int x;.DWrap the code inside the foo() method with a synchronized( this ) block.EWrap the for loop code inside the go() method with a synchronized block synchronized(this) { // for loop code here }.

多选题Which three protocols should be explicitly managed by using a CoPP policy on an Internet border router?()ASMTPBICMPCBGPDSSHERTPFBitTorrentGVTP

单选题Which statement is true for the class java.util.ArrayList?()A The elements in the collection are ordered.B The collection is guaranteed to be immutable.C The elements in the collection are guaranteed to be unique.D The elements in the collection are accessed using a unique key.E The elements in the collections are guaranteed to be synchronized.

多选题Which three changes should be made to adapt this class to be used safely by multiple threads?()Adeclare reset() using the synchronized keywordBdeclare getName() using the synchronized keywordCdeclare getCount() using the synchronized keywordDdeclare the constructor using the synchronized keywordEdeclare increment() using the synchronized keyword