String str2 = " ";
str2.trim(); // if we use str2 = str2.trim(); the answer will be true true
System.out.println(str2.equals("") + " " + str2.isEmpty());
The trim() method in Java String is a built-in function that eliminates leading and trailing space
Answer is C
false false
Correct answer C because String is immutable so it can't be changed. Here trim() has no effect on str. If we had: "str = str.trim();" the correct answer would have been true true.
C is correct. You should try the following code.
public static void main(String[] args) {
String str = "";
str.trim ();
System.out.println (str.equals ("") + "" + str.isEmpty ());
}
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.
letmein2
Highly Voted 6 years agov323rs
Highly Voted 5 years, 5 months agoMPignaProTech
Most Recent 8 months, 2 weeks agoKolodets
2 years, 2 months agoVicky_65
2 years, 2 months agoodzio33
2 years, 5 months agoRipfumelo
2 years, 5 months agoRoxyFoxy
2 years, 9 months agoXalaGyan
3 years, 5 months agoRaju15
4 years, 3 months agoAyla
4 years, 7 months agopillu2012
4 years, 9 months agohcampos
4 years, 9 months agotamanna786
4 years, 9 months agopillu2012
4 years, 9 months agohcampos
4 years, 9 months agoatlassi708
4 years, 7 months agoM_Jawad
5 years, 6 months ago