Answer is A. Because String str is "Sweet Sweat" not "Sweet sweat"
String str="Sweet Sweat";
String str2=str.trim().charAt(6)+" " + str.indexOf("Sw",1);
System.out.println(str2); // S 6
The answer is the letter C, it is a little complicated but analyzing the code we managed to answer the question ignoring the difficult part. Looking at "str.indexOf("Sw",1)" we can see that it wants to know what is the position of the first "Sw" that appears in the String content and we can see that it is at position 1. The only alternative that prints the 1 in the second position of the string "str2" is the C option.
This section is not available anymore. Please use the main Exam Page.1z0-808 Exam Questions
Log in to ExamTopics
Sign in:
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.
Sudhakar_Senthilkumar
3 months, 2 weeks agoMPignaProTech
5 months, 3 weeks agoakbiyik
2 years, 4 months agocarloswork
2 years, 4 months agoUAK94
2 years, 6 months agoiSnover
2 years, 6 months agoJess1985B
1 year, 5 months ago