第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

沒顯示錯誤但是運行一直錯誤Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException:

沒顯示錯誤但是運行一直錯誤Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException:

慕粉小蝸牛 2016-06-26 21:22:19
public class Pukes {?public String color;?public String number;?public List<Pukes> pukes;? public List<String>colors;? public List<String>numbers;? public Pukes(String color,String number){ ?this.color=color; ?this.number=number;? }? public Pukes(){ ?//this.pukes=new ArrayList<>(); ?this.colors=new ArrayList<String>(); ?this.numbers=new ArrayList<String>();}???public void colorsAdd(){ ?colors.add("黑桃"); ?colors.add("紅桃"); ?colors.add("梅花"); ?colors.add("方片"); String dd=colors.get(2); System.out.println(dd);? }? public void numbersAdd(){ numbers=Arrays.asList("2","3","4","5","6","7","8","9","J","Q","K","A"); ?String cm= numbers.get(0); ?System.out.println(cm);? } ?public void testPukes(){ List<Pukes> pukes=new ArrayList<>();? ? ?for(int i=0;i<52;i++){ ? ?String cm=null; ?String dd=null; ?int cm1=i%13; cm=numbers.get(cm1); ? ? ? ? ?int cm2=i%4; ?dd=colors.get(cm2); Pukes temp=new Pukes("dd","cm"); pukes.add(temp); ?} ?for(Pukes pu:pukes){ ? ?System.out.println(pu.color+pu.number); ?}、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 12 at java.util.Arrays$ArrayList.get(Arrays.java:3841) at com.pkyx.Pukes.testPukes(Pukes.java:44) at com.pkyx.Pukes.main(Pukes.java:64)。。。。。。。。。。。。。。。。。。。。。。。。。。 cm=numbers.get(cm1);這里
查看完整描述

1 回答

已采納
?
yanrun

TA貢獻317條經(jīng)驗 獲得超240個贊

因為你的numbers的下標是從0到11,而計算的結(jié)果是12,所以會報錯

查看完整回答
反對 回復(fù) 2016-06-26
  • 1 回答
  • 1 關(guān)注
  • 2280 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號