当前位置: 代码迷 >> Java Web开发 >> [讨论]一道104题(知道什么是104吧)
  详细解决方案

[讨论]一道104题(知道什么是104吧)

热度:227   发布时间:2006-08-10 11:15:51.0
[讨论]一道104题(知道什么是104吧)

98. Given:

13. public class Test {
14. public static void main (String [] args) {
15. StringBuffer a = new StringBuffer (“A”);
16. StringBuffer b = new StringBuffer (“B”);
17. operate (a,b);
18. system.out.printIn{a + “,” +b};
19. )
20. static void operate (StringBuffer x, StringBuffer y) {
21. y.append (x);
22. y = x;
23. )
24. }

What is the result?

A.The code compiles and prints “A,B”.
B.The code compiles and prints “A, BA”.
C.The code compiles and prints “AB, B”.
D.The code compiles and prints “AB, AB”.
E.The code compiles and prints “BA, BA”.
F.The code does not compile because “+” cannot be overloaded for stringBuffer.

[此贴子已经被作者于2006-8-10 11:16:37编辑过]


----------------解决方案--------------------------------------------------------

13. public class Test {
14. public static void main (String [] args) {
15. StringBuffer a = new StringBuffer (“A”);
16. StringBuffer b = new StringBuffer (“B”);
17. operate (a,b);
18. system.out.printIn{a + “,” +b};
19. )
20. static void operate (StringBuffer x, StringBuffer y) {
21. y.append (x);
22. y = x;
23. )
24. }


----------------解决方案--------------------------------------------------------
楼上什么意思啊.........
----------------解决方案--------------------------------------------------------
  相关解决方案