Re: [問題] Selection Sorting的問題

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