What are legal operations on s? String s = "something"; A.s >>= "ok"; B.char c = s[4]; C.s += 3; D.s -= "thing"; E.s = s + "good";
Answer is C & E ?? -Arun
Jose Botella
Ranch Hand
Joined: Jul 03, 2001
Posts: 2120
posted
0
Because it's possible to concatenate strings with the + operator. But it isn't possible to substract, shift or access them as they would be a char array.
Originally posted by Jose Botella: Because it's possible to concatenate strings with the + operator. But it isn't possible to substract, shift or access them as they would be a char array.
Exactly -- in Java the + operator is overloaded -- meaning it has a different function depending on the type of operands it is used with. So C would produce the string "Something3" and E would produce the string "Somethinggood"