Re: [問題] Selection Sorting的問題
※ 引述《sonicno111 (PP)》之銘言:
: 我貼一下現在的進度
: 只貼了執行SORTING那部份
: public void selectSort(){
: tempArr= new int[selectArr.length];
: }
: 這樣子有沒有不對勁阿?@@
: (selectArr是之前就有設的陣列_
假設這句話代表的意義是selectArr是datamember ,
請確認在執行這個方法之前,selectArr是已經初始化的.
如果selectArr不是global變數,那你的這句話就有問題了~
問題是出在selectArr,所以檢查看看吧. :)
: 每次都說tempArr= new int[selectArr.length];這行出問題?
: java.lang.NullPointerException....這句不懂>/////<
: 另外...可不可以請教一下取亂數該用哪種rand的比較好呢?@@
: 謝謝
: 另外...還有有沒有其他可以不用讓selectArr[s]變成-1而讓他消失的方法?@@
: 每次都要再檢查那個-1好像是一種浪費...
--
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.pratice()); | Bone everything
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.138.240.58
※ 編輯: TonyQ 來自: 140.138.240.58 (05/14 13:45)
討論串 (同標題文章)
java 近期熱門文章
PTT數位生活區 即時熱門文章