作者TonyQ (骨头)
看板java
标题Re: [问题] print char[]问题
时间Sat Mar 10 07:14:00 2007
※ 引述《walm20 (我要买车啦)》之铭言:
: 这是我看书 自己测试的
: char str1[]={'f','u','c','k',' ','y','o','u'};
: char str2[]=new char [20];
: System.out.println("str1[]="+str1);
: System.arraycopy(str1,0,str2,0,str1.length);
: System.out.println("str2[]="+str2);
: str1[]=[C@6b97fd
: str2[]=[C@1c78e57
: 跟书上写的 只差 str1的内容而已
: 请问为什麽是这样结果阿?
你应该做的是去了解为甚麽书上会写这个范例,
当然去找找勘误表也是该做的尝试啦。(有些书会在网路上提供这项资讯)
you can try
System.out.println("str1[]="+ new String(str1));
And you can read the chapter about "String" 、 "Array"
--
String temp="relax"; | Life just like programing
while(buringlife) String.forgot(temp); | to be right or wrong
while(sleeping) brain.setMemoryOut(); | need not to say
stack.push(life.running); | the complier will
stack.push(scouting.buck()); | answer your life
stack.push(bowling.practice()); | Bone
everything
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.134.27.68