public class Test {
public static void main(String[] args) {
String ta = "A ";
System.out.println(ta);
ta = ta.concat("B ");
System.out.println(ta);
String tb = "C ";
ta = ta.concat(tb);
System.out.println(ta);
ta.replace("B" ,"C");
System.out.println(ta);
ta = ta.concat("D");
System.out.println(ta);
}
try this if wanna understand more on this
public class Test {
public static void main(String[] args) {
String ta = "A ";
System.out.println(ta);
ta = ta.concat("B ");
System.out.println(ta);
String tb = "C ";
ta = ta.concat(tb);
System.out.println(ta);
ta.replace("B" ,"C");
System.out.println(ta);
ta = ta.concat("D");
System.out.println(ta);
}
try this if wanna understand more on this
if my understanding is correct, ta.replace is not assigning it back to ta. Strings are immutable, meaning they cannot be changed like that. you need the line to say ta=ta.replace. Anyone can correct if wrong. God bless.
Correct, Answer is A.
To test:
public static void main(String[] args) {
String ta = "A ";
ta = ta.concat("B ");
String tb = "C ";
ta = ta.concat(tb);
ta.replace("B" ,"C");
ta = ta.concat("D");
System.out.println(ta);
}
upvoted 2 times
...
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.
shiv2
8 months, 1 week agoshiv2
8 months, 1 week agoDriftKing
9 months, 3 weeks agopbbvr
10 months, 3 weeks agoEricausdresden
11 months, 1 week agoFollowingJesus
1 week, 6 days agocarloswork
1 year, 8 months ago