问答详情
源自:7-1 简易扑克牌游戏

创建扑克牌添加时出现问题,请求指教

//——---------------主干程序-----------------------------------

package com.afterHomework.puKe;


import java.util.ArrayList;

import java.util.List;


public class PukeMajor {


/**

* @param args

*/

public void pukeMajor(){


}

public void createPuke(){

List<PukeCollection> pukecList=new ArrayList<PukeCollection>();


System.out.println("-------------------创建扑克牌--------------------");

String[] variety={"黑桃","红桃","梅花","方片"};


String[] number={"2","3","4","5","6","7","8","9","10","J","Q","K","A"};

for(int i=0;i<variety.length;i++){

for(int j=0;j<number.length;j++){


pukecList.add(new PukeCollection(variety[i]+number[j]));

}

}

}

public static void main(String[] args) {

// TODO Auto-generated method stub


}


}

//----------------------------------辅助程序------------------------

package com.afterHomework.puKe;


public class PukeCollection {

public String variety;

public String number;

public void pukeCollection(String variety,String number){

this.variety=variety;

this.number=number;

}

}

问题如图片所示:http://img.mukewang.com/577e21870001d1e909570540.jpg

提问者:陈婉 2016-07-07 17:32

个回答

  • 黄建林
    2016-07-07 20:21:00
    已采纳

    你那PukeCollection类的那个构造函数不是这样写的 构造函数没有返回值的 应该去掉void