ブラック ジャック プログラムにエラーがあります。私はそれを見つけるために30分試みてきました。「タイプカードは既に定義されています」と表示されます。何らかの理由で私の deal() 関数も機能していません。私はこれをより多くの情報とともに再度投稿しています。誰でも助けてもらえますか?私は初心者です。したがって、メインメソッドが次のような index という名前のクラスがあります。
public static void main(String[] args){
runGame(2);
}
次に、いくつかのメソッドがあり、runGame があります。
public static void runGame(int n){
Card[] newdeck=createCardArray();
Card[] shuffleddeck = shuffle(newdeck);
Deck deck = new Deck(shuffleddeck);
int[] players = createPlayers(n);
int[] points = createPoints(n);
for(int i = 0 ; i< players.length - 1; i++){
Card a = deck.deal();
Card b = deck.deal();
updatePoints(players, points, i, a);
updatePoints(players, points, i, b);
}
printPlayersPoints(players, points);
}
そのフォルダーには、Card.class と Deck.class もあります。見たい場合は、以下のリンクを参照してください。これを実行するとエラーが発生します。何をしたかわかりませんが、変更されました:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The public type Deck must be defined in its own file
Syntax error on token "}", { expected
Syntax error on token(s), misplaced construct(s)
The public type Card must be defined in its own file
Syntax error on tokens, delete these tokens
The public type Blackjack must be defined in its own file
Syntax error on token "]", invalid (
Syntax error, insert "]" to complete ArrayAccess
Syntax error, insert ")" to complete MethodInvocation
Syntax error, insert ";" to complete Statement
GIO cannot be resolved
GIO cannot be resolved
GIO cannot be resolved
BlackjackWindow cannot be resolved to a type
BlackjackWindow cannot be resolved to a type
GIO cannot be resolved
BlackjackWindow cannot be resolved to a type
Syntax error on token "}", { expected
Syntax error on token(s), misplaced construct(s)
The public type Hand must be defined in its own file
Syntax error on tokens, delete these tokens
The public type Player must be defined in its own file
Syntax error, insert "}" to complete Block
BlackjackWindow cannot be resolved to a type
BlackjackWindow cannot be resolved to a type
GIO cannot be resolved
GIO cannot be resolved
BlackjackWindow cannot be resolved to a type
GIO cannot be resolved
GIO cannot be resolved
GIO cannot be resolved
GIO cannot be resolved
GIO cannot be resolved
Syntax error on token "}", { expected
Syntax error on tokens, delete these tokens
Syntax error, insert "}" to complete Block
Syntax error, insert "}" to complete ClassBody
at Card.<init>(fullblk.java:4)
at index.createCardArray(index.java:19)
at index.runGame(index.java:104)
at index.main(index.java:3)
しかし、何らかの理由で今回はこのエラーが発生しています:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The constructor Deck(Card[]) is undefined
The method deal() is undefined for the type Deck
The method deal() is undefined for the type Deck
at index.runGame(index.java:101)
at index.main(index.java:3)
誰でも私を助けてください。
index.java: http://pastebin.com/8x344TN9 Card.java: http://pastebin.com/NLbHBDSi Deck.java:http://pastebin.com/emD75yv0