Oracle Certified Associate Java Se 8 Programmer · Free Practice Question Hard

Question 12

Consider the code:

What is the result ?

  • A

    ur

  • B

    ua

  • C

    uga

  • D

    ga

Reveal correct answer

Correct answer: B

Explanation

sb.deleteCharAt(0);===>it deletes 'd' and now content is "urga" sb.delete(1,3);===>delete characters from index 1 to 2. Hence "rg" will be deleted. Hence the output is: ua

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need