exam questions

Exam 1z0-808 All Questions

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

Exam 1z0-808 topic 1 question 102 discussion

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

Given the code fragment:

What is the result?

  • A. 5 : 5
  • B. 10 : 10
  • C. 5 : 10
  • D. Compilation fails.
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

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
v323rs
Highly Voted 4 years ago
The correct answer B 10 10
upvoted 10 times
...
KeletsoM23
Most Recent 7 months ago
compilation will fail due to a missing ;. but if we replace that semi colon and run it, the out out will be 10:10
upvoted 1 times
...
carloswork
1 year, 3 months ago
Selected Answer: B
Answer is B. To test: public class Test { static int count = 0; int i = 0; public void changeCount() { while(i<5) { i++; count++; } } public static void main (String [] args) { Test check1 = new Test (); Test check2 = new Test (); check1.changeCount(); check2.changeCount(); System.out.print(check1.count + " : " + check2.count); } }
upvoted 2 times
...
Deviramu
2 years, 1 month ago
C is the right answer
upvoted 1 times
shivkumarx
1 year, 4 months ago
if count is static, how can it print 2 different values?
upvoted 3 times
...
...
brianhuang881215
2 years, 5 months ago
what a good host
upvoted 1 times
...
AmineGh
2 years, 10 months ago
public class count { static int count =0; int i =0; public void changeAccount() { while(i<5) { i++; count++; } } public static void main(String args[]) { count c1= new count(); count c2 = new count(); c1.changeAccount(); c2.changeAccount(); System.out.println(c1.i + ":"+c2.count ); } } Ansewer is c : 5:10
upvoted 1 times
mz0
1 year, 6 months ago
it is c1.count. your code has c1.i
upvoted 2 times
...
iSnover
1 year, 4 months ago
Impossible, an static variable can only have one value, is 10 and 10
upvoted 2 times
...
...
SSJ5
2 years, 10 months ago
Answer is B
upvoted 1 times
...
onyddimmav4576
3 years, 1 month ago
Compilation fails missing a ;
upvoted 3 times
...
hackGh
3 years, 2 months ago
b 10:10 count is static
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