問題文
A developer assigns text that has one leading and one trailing space to a String variable named label, calls label.strip() and then label.replace('a', 'b'), and prints label. What appears on the console?
選択肢
- The original text with both of the spaces, because each call gives back a new String and leaves the object that label points at untouched
- Nothing appears at all, because the compiler rejects any statement whose String result is discarded without being used in that case
- The text without the two spaces but with the letters unchanged, because strip works in place while replace needs its result to be assigned
- The text with the letters swapped and without the two spaces, because the two calls change the characters of the variable one after the other in place