AllExam Dumps

DUMPS, FREE DUMPS, VCP5 DUMPS| VMWARE DUMPS, VCP DUMPS, VCP4 DUMPS, VCAP DUMPS, VCDX DUMPS, CISCO DUMPS, CCNA, CCNA DUMPS, CCNP DUMPS, CCIE DUMPS, ITIL, EXIN DUMPS,


READ Free Dumps For Oracle- 1z0-851





Question ID 3708

Given:
1.    public class TestFive {
2.    private int x;
3.    public void foo() {
4.    int current = x;
5.    x = current + 1;
6.    }
7.    public void go() {
8.    for(int i = 0; i < 5; i++) {
9.    new Thread() {
10.    public void run() {
11.    foo();
12.    System.out.print(x + ", ");
13.    } }.start();
14.    } }
Which two changes, taken together, would guarantee the output: 1, 2, 3, 4, 5, ? (Choose two.)

Option A

A. move the line 12 print statement into the foo() method
 

Option B

B.    change line 7 to public synchronized void go() {
 

Option C

C.    change the variable declaration on line 2 to private volatile int x;
 
 

Option D

D.    wrap the code inside the foo() method with a synchronized( this ) block
 

Option E

E.    wrap the for loop code inside the go() method with a synchronized block synchronized(this) { // for loop code here }
 

Correct Answer A,D
Explanation


Question ID 3709

Given:
1.    public class Threads2 implements Runnable {
2.    
3.    public void run() {
4.    System.out.println("run.");
5.    throw new RuntimeException("Problem");
6.    }
7.    public static void main(String[] args) {
8.    Thread t = new Thread(new Threads2());
9.    t.start();
10.    System.out.println("End of method.");
11.    }
12.    }
Which two can be results? (Choose two.)

Option A

A. java.lang.RuntimeException: Problem
 

Option B

B.    run.
java.lang.RuntimeException: Problem
 

Option C

C.    End of method.
java.lang.RuntimeException: Problem
 

Option D

D.    End of method.
run.
java.lang.RuntimeException: Problem
 

Option E

E.    run.
java.lang.RuntimeException: Problem
End of method.
 

Correct Answer D,E
Explanation

Send email to admin@getfreedumps for new dumps request!!!