当前位置:编程学习 > JAVA >>

运行出错问题

刚学java,做一个发牌游戏,一副牌52张,发给2-6个人,下是代码,但是提示一下错位,搞不懂,请给位指教一下,谢谢!!
package PokerGame;
import javax.swing.JOptionPane;
public class PokerGame {

    public static void main(String[] args) {
         int i,j,k;
        String[] suit={"黑桃", "红心", "草花", "方块"};
        String[] rank={"A", "2", "3", "4","5","6","7","8","9","10","J","Q","K"};
        String[] person=new String[6];
        int[] prt=new int [30];
        int[] Pokernum=new int[52];
        String peoplenumber = JOptionPane.showInputDialog("请输入玩家数目(2至6):");
        int num = Integer.parseInt(peoplenumber);
        for(i=0;i<Pokernum.length;i++)//生成数组并打乱
        {   
           Pokernum[i]=i;
        }
        for(i=0;i<Pokernum.length;i++)
        {
            int index=(int)Math.random()*Pokernum.length;
            int temp=Pokernum[i];
            Pokernum[i]=Pokernum[index];
            Pokernum[index]=temp;
        }
        for(j=0;j<num;j++)
        {
          for(i=j,k=0;i<52;i=i+num,k++) 
          {
            prt[k]=Pokernum[i];
          
            java.util.Arrays.sort(prt, 0, k);//对该人的牌进行排列
            for(i=0;i<k;i++)
            {
               person[j]= person[j]+suit[prt[i]/13]+rank[prt[i]%14]+" ";
               if(prt[i]/13!=prt[i+1]/13)
                  person[j]= person[j]+"\n"; 
            }
          }
    }
            JOptionPane.showMessageDialog(null, "发牌结果出来啦,请点确定");
        for (j = 0; j <=num; j++) {
            k = j + 1;
            JOptionPane.showMessageDialog(null, "第" + k + "个人的牌的情况\n" + person[j]);
        }
        JOptionPane.showMessageDialog(null, "发牌结束");
          
              
        }
}
以下是错误提示:
run:
java.lang.NoClassDefFoundError: pokergame/PokerGame (wrong name: PokerGame/PokerGame)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Exception in thread "main" Java Result: 1
成功构建 (总时间: 2 秒)

        
         java exception thread
补充:Java ,  Java EE
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,