exam questions

Exam 1z0-808 All Questions

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

Exam 1z0-808 topic 1 question 109 discussion

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

Given the code fragment:

What is the result?

  • A. An exception is thrown at runtime.
  • B. -1
  • C. 5
  • D. 10
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
iSnover
Highly Voted 9 months, 3 weeks ago
Selected Answer: C
The correct answer is the letter C, String is immutable, that is, it is necessary to create a new variable, in the line "myStr.trim();" as no variables are assigned, the line is almost forgotten because it compiles. As java indexes from 0 it prints 5 which is the C answer.
upvoted 5 times
...
Vicky_65
Most Recent 3 months, 2 weeks ago
Selected Answer: C
c is correct
upvoted 1 times
...
akbiyik
7 months, 2 weeks ago
Selected Answer: C
The correct answer is C.
upvoted 1 times
...
alex_au
9 months, 3 weeks ago
Tested, C
upvoted 2 times
...
shivkumarx
10 months, 1 week ago
The correct answer is 6, even with myStr.trim(), the first space is at character 6
upvoted 1 times
shivkumarx
10 months, 1 week ago
5 i mean
upvoted 2 times
...
iSnover
9 months, 3 weeks ago
Java indexes from 0, so prints 5.
upvoted 1 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