The initial string str is "Hello Java", which has a length of 10 characters.
The length() method is used to get the length of the string, and it's printed to the console, resulting in 10.
The concat method is used to concatenate the string "SE 8" to the end of the original string. The result of the concatenation is "Hello JavaSE 8", which has a length of 14 characters.
The length() method is again used to get the length of the string after concatenation, and it's printed to the console, resulting in 14.
my friend , last information in your comment is wrong , the answer will be 10 10
because concat did not change the original string ! ! !
upvoted 2 times
...
...
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.
dvpreddy
4 months, 3 weeks agodvpreddy
4 months, 3 weeks agotombatossals
4 months, 3 weeks agozoe12345
5 months, 1 week agoYousef10
4 months, 3 weeks ago