Re: [問題 ]關於ArrayList<String[]> 的使用方法
※ 引述《tabascobath (??)》之銘言:
: ※ 引述《PsMonkey (痞子軍團團長)》之銘言:
: : 最主要的問題是,你的 a1 並沒有指定他是 ArrayList<String[]>
: : 所以他就會當成一般的 ArrayList(裡頭塞的只當成是物件)
: : 所以你 mark 掉的寫法會出問쌊: 感謝這位大大的回應 但是我使用
: ArrayList<String[]> al=new ArrayList<String[]>();
: 這個用法會出現error
: 煩請各位大大幫幫忙 謝謝!
想想再問好不好?
如果你要指定,當然是要用。
ArrayList<ArrayList<String[]>> a1 =
new ArrayList<ArrayList<String[]>>();
然後透過add兩個 ArrayList<String[]> 的方式去處理。
不然,轉型會吧?
System.out.println( ((String[])al[0].get(1))[0] );
其實這解法上一篇你回的文章裡面也有了,
連問題程式碼都打錯,我也拜託你『幫幫忙』把程式碼打對,
看過別人的回答後再問新問題。
--
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: 61.218.69.114
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 6 之 7 篇):