java编译提示非法的表达式开始,需要“;”
importjava.awt.event.*;importjavax.swing.*;importjava.awt.*;publicclassDeckOfCardsext...
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
public class DeckOfCards extends JFrame
{
private Card Deck[];
private JButton Shuffle;
private JButton Array[];
private JPanel p1;
private JPanel p2;
private JLabel st;
private int now;
public DeckOfCards()
{
super("Card Grid game");
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
String faces[] = { "Ace", "Deuce", "Three", "Four", "Five", "Six"};
String suits[] = { "Heart", "Diamond", "Club", "Spade" };
Deck = new Card[24];
now = -1;
for (int i = 0; i < 24; i++)
Deck[i] = new Card(faces[i % 6], suits[i / 6]);
public void Shuffle()
{
now = -1;
for (int i = 0; i < 24; i++)
{
int j = (int) (Math.random() * 24);
// Swap The Cards
Card t = Deck[i];
Deck[i] = Deck[j];
Deck[j] = t;
}
} 展开
import javax.swing.*;
import java.awt.*;
public class DeckOfCards extends JFrame
{
private Card Deck[];
private JButton Shuffle;
private JButton Array[];
private JPanel p1;
private JPanel p2;
private JLabel st;
private int now;
public DeckOfCards()
{
super("Card Grid game");
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
String faces[] = { "Ace", "Deuce", "Three", "Four", "Five", "Six"};
String suits[] = { "Heart", "Diamond", "Club", "Spade" };
Deck = new Card[24];
now = -1;
for (int i = 0; i < 24; i++)
Deck[i] = new Card(faces[i % 6], suits[i / 6]);
public void Shuffle()
{
now = -1;
for (int i = 0; i < 24; i++)
{
int j = (int) (Math.random() * 24);
// Swap The Cards
Card t = Deck[i];
Deck[i] = Deck[j];
Deck[j] = t;
}
} 展开
1个回答
展开全部
public DeckOfCards()
{
super("Card Grid game");
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
String faces[] = { "Ace", "Deuce", "Three", "Four", "Five", "Six"};
String suits[] = { "Heart", "Diamond", "Club", "Spade" };
Deck = new Card[24];
now = -1;
for (int i = 0; i < 24; i++)
Deck[i] = new Card(faces[i % 6], suits[i / 6]);
public void Shuffle()
{
你在构造方法里面怎么能再定义方法呢?
{
super("Card Grid game");
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
String faces[] = { "Ace", "Deuce", "Three", "Four", "Five", "Six"};
String suits[] = { "Heart", "Diamond", "Club", "Spade" };
Deck = new Card[24];
now = -1;
for (int i = 0; i < 24; i++)
Deck[i] = new Card(faces[i % 6], suits[i / 6]);
public void Shuffle()
{
你在构造方法里面怎么能再定义方法呢?
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询