Re: [問題] print char[]問題

看板java作者 (骨頭)時間19年前 (2007/03/10 07:14), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串8/13 (看更多)
※ 引述《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
文章代碼(AID): #15yUewZh (java)
討論串 (同標題文章)
文章代碼(AID): #15yUewZh (java)