package com.imooc.pukeyouxi;import java.util.ArrayList;import java.util.List;public abstract class puke { public String huase; public String dianshu; public puke(String huase,String dianshu){ this.huase=huase; this.dianshu=dianshu; } public puke(){ } }package com.imooc.pukeyouxi;import java.util.ArrayList;import java.util.List;/* * * 加入整个扑克 我觉得此处用map<>更好,有坐标及内容。通过坐标比较 * 但是list 可以做位置的比较 * */public class listpuke { public List<puke> pukelist=new ArrayList<puke>(); public void addall(){ //建立点数数组 String [] dianshuji={"2","3","4","5","6","7","8","9","10","J","Q","K","A"}; //建立花色数组 String [] huaseji={"方块","梅花","红桃","黑桃"}; for(int i=0;i<huaseji.length;i++){ for(int j=0;j<dianshuji.length;j++){ puke cr1=new puke(huaseji[i],dianshuji[j]);//此处提示异常,不能实力化 类型 是什么问题啊?求解 pukelist.add(cr1); } } System.out.println("--------------扑克拆包成功:-----------"); System.out.println("目前扑克牌为:"); for(puke list:pukelist){ System.out.println(list); }}}
添加回答
举报
0/150
提交
取消