How many String objects are created by the following statements ?String str = " a+b=10 "; trim(str) str.replace(+,-);(a) 1 (b) 2 (c) 3 (d) 4

(c)

Strings are immutable. So, for each String operation, one new object is generated.

Showing Answers 1 - 1 of 1 Answers

surendran

  • Jun 10th, 2006
 

String objects are immutable. Only String buffer is mutable. As the above variable is of type string only one string object is created.

Answers is (a)

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions