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

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

Java入門第三季求助

Java入門第三季求助

神華內斂方能以柔克剛 2018-03-02 16:55:53
我嘗試這用記事本完成《Java入門第三季》的最終作業(yè),調試了一下午才編譯通過,又顯示“找不到或無法加載主類”,求幫忙看一下,多謝了!package?game; public?class?Main{ public?static?void?main?(String?[]?args){ new?Game(); } }package?game; import?java.util.Scanner; import?java.util.Random; import?java.util.List; import?java.util.ArrayList; public?class?Game?{ List<Card>?cards; Player?playerA,playerB; short?a; Card?temporary; Random?random; public?Game(){ this.random?=?new?Random(); this.cards?=?new?ArrayList<Card>(); Scanner?scanner?=?new?Scanner(System.in); System.out.println("please?input?first?player's?name"); this.playerA?=?new?Player(scanner.next()); System.out.println("please?input?second?player's?name"); this.playerB?=?new?Player(scanner.next()); System.out.println("loading"); //開始洗牌 for(short?times?=?0;times?<?52;times?++){ do{ this.temporary?=?new?Card((short)(random.nextInt(13)+1),(short)(random.nextInt(4)+1)); }while(this.cards.contains(temporary)); } System.out.println("please?waite?a?minute"); //開始發(fā)牌 a?=?(short)random.nextInt(this.cards.size()); this.playerA.take(this.cards.get(a)); this.cards.remove(a); a?=?(short)random.nextInt(this.cards.size()); this.playerB.take(this.cards.get(a)); this.cards.remove(a); a?=?(short)random.nextInt(this.cards.size()); this.playerA.take(this.cards.get(a)); this.cards.remove(a); a?=?(short)random.nextInt(this.cards.size()); this.playerB.take(this.cards.get(a)); this.cards.remove(a); //開始比較 System.out.println("fight"); if(this.playerA.show().compareTo(this.playerB.show())?>?0){ System.out.println("Player:A?Wins?!"); }else?{ System.out.println("Player:B?Wins?!"); } //游戲結束 System.out.println("Game?Over?!"); } }package?game; public?class?Card?implements?Comparable?<Card>{ short?number; short?shape; public?Card(short?number,short?shape){ this.number?=?number; this.shape?=?shape; } public?int?compareTo(Card?card){ if(this.number?==?card.number){ return?(new?Integer(this.shape)).compareTo(new?Integer(card.shape)); }else?{ return?(new?Integer(this.number)).compareTo(new?Integer(card.number)); } } public?boolean?equals(Card?card){ if?(this.number?==?card.number?&?this.shape?==?card.shape){ return?true; }else{ return?false; } } }package?game; import?java.util.List; import?java.util.ArrayList; import?java.util.Collections; public?class?Player?{ String?name; List<Card>?cards; public?Player(String?name){ this.name?=?name; this.cards?=?new?ArrayList<Card>(); } public?Card?show?(){ Collections.sort(this.cards); return?this.cards.get(1); } public?void?take?(Card?card){ this.cards.add(card); } }
查看完整描述

1 回答

?
carolcoral

TA貢獻41條經驗 獲得超9個贊


如果你確定代碼、邏輯都沒問題建議重啟 eclipse,今天遇到幾次一切都沒問題就是404的情況,重啟 eclipse 就好了
查看完整回答
反對 回復 2018-03-05
  • 1 回答
  • 0 關注
  • 1130 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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