一道选择题,请大家来看看
Given:
11. public String makinStrings() {
12. String s = “Fred”;
13. s = s + “47”;
14. s = s.substring(2, 5);
15. s = s.toUpperCase();
16. return s.toString();
17. }
How many String objects will be created when this method is invoked?
A. 1
B. 2
C. 3
D. 4
E. 5
F. 6
这是SCJP的一道选择题。
为什么答案选C?
我觉得应该选E,5个boject分别为:Fred, 47, Fred47, ed4, ED4
大家觉得呢?