[問題] 以泛型儲存亂數
一道題目以泛型型態儲存5個小於50的亂數
TreeSer<Integer> ts = new TreeSet<Integer>();
for(int i=0; i<5; i++){
ts.add((int)(Math.random()*50+1));
}
其中最後的 +1 是為了甚麼
煩請指教
http://ideone.com/0uJU9
編譯失敗是為甚麼@@
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.128.195.235
推
06/16 14:02, , 1F
06/16 14:02, 1F
※ 編輯: coilion9670 來自: 140.128.195.235 (06/16 15:11)