exam questions

Exam 1z0-809 All Questions

View all questions & answers for the 1z0-809 exam

Exam 1z0-809 topic 1 question 165 discussion

Actual exam question from Oracle's 1z0-809
Question #: 165
Topic #: 1
[All 1z0-809 Questions]

Given:

What change should you make to guarantee a single order of execution (printed values 1 -100 in order)?

  • A. Line 3: public synchronized void run() {
  • B. Line 1: class MyClass extends Thread {
  • C. Line 2: public volatile int value;
  • D. Line 2: public synchronized int value;
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
steefaand
5 months, 4 weeks ago
Selected Answer: A
A is correct.
upvoted 1 times
...
WilsonKKerll
2 years, 4 months ago
Answer is A. Change-> MyClass mc = new MyClass(); Thread a = new Thread(mc); a.start(); Thread b = new Thread(mc); b.start();
upvoted 1 times
...
mevlt
2 years, 5 months ago
Selected Answer: A
Answer A
upvoted 2 times
...
Svetleto13
3 years, 2 months ago
I am agreed with you.Answer is A,tested with MyClass mc = new MyClass();
upvoted 1 times
Svetleto13
3 years, 2 months ago
I changed it to MyClass mc = new MyClass(); and compile or even if we try with class MyClass extends Thread or public synchronized run() is still compile.So compiltion error is answer.
upvoted 1 times
...
...
Abdullah_Rahahleah
3 years, 7 months ago
Myclass mc = new Thread(mc) has a compilation error
upvoted 3 times
...
pul26
3 years, 7 months ago
Answer is A
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago