exam questions

Exam 1z0-808 All Questions

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

Exam 1z0-808 topic 1 question 72 discussion

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

Given:

What is the result?

  • A. myStr: 9009, myNum: 9009
  • B. myStr: 7007, myNum: 7007
  • C. myStr: 7007, myNum: 9009
  • D. Compilation fails
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

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
letmein2
Highly Voted 4 years, 5 months ago
correct. The myStr in try block becomes out-of-scope when it reaches the print line.
upvoted 16 times
...
dya45792
Highly Voted 4 years, 1 month ago
Antwort C, ist richtig public class App { String myStr = "7007"; public void doStuff(String str) { int myNum = 0; try { String myStr = str; myNum = Integer.parseInt(myStr); } catch (NumberFormatException ne) { System.err.println("Error"); } System.out.println("myStr:" + myStr + "myNum:" + myNum); } public static void main(String[] args) { App obj = new App(); obj.doStuff("9009"); } } myStr:7007 myNum:9009
upvoted 11 times
...
Sreeni_A
Most Recent 5 months, 2 weeks ago
Correct answer is C
upvoted 1 times
...
CreazyyyyGirl
10 months, 4 weeks ago
Selected Answer: C
Correct Answer is C
upvoted 1 times
...
carloswork
1 year, 3 months ago
Selected Answer: C
Correct, Answer is C.
upvoted 1 times
...
TondyNetsh
1 year, 10 months ago
Selected Answer: C
correct. The myStr in try block becomes out-of-scope when it reaches the print line.
upvoted 1 times
...
ravshan87
2 years, 4 months ago
The correct answer would be D, if the author is serious here to miss a closing brace at the end of the class.
upvoted 2 times
ravshan87
2 years, 4 months ago
I take it back, C is the correct Answer. No braces are missing.
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