求教:下面的代码怎么无法输出扑克的值
//Card类 package com.imooc; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Card { private String color; private String value; private static final List<String> Colors = Arrays.asList("方块", "草花", "红桃","黑桃"); private static final List<String> Values = Arrays.asList("2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"); public Card(String color, String value) { super(); this.color = color; this.value = value; } public Card() { super(); // TODO Auto-generated constructor stub } //创建一副扑克 public static List<Card> generatePoker(){ //创建扑克集合 List<Card> pokerlist=new ArrayList<Card>(); //为扑克集合赋值 for(int i=0;i<4;i++){ String newColor=Colors.get(i); for(int j=0;j<13;j++){ String newValue=Values.get(j); Card newCard=new Card(newColor,newValue); pokerlist.add(newCard); } } return pokerlist; } }
//playInitial类 package com.imooc; import java.util.List; public class playInitial { private List<Card> cardList; public playInitial() { cardList=Card.generatePoker(); } //显示创建的扑克的信息 public void showCardList(){ System.out.println(cardList.toString()); } public static void main(String[] args) { System.out.println("--------创建扑克--------"); playInitial pi=new playInitial(); pi.showCardList(); } }
输出结果:
--------创建扑克--------
[com.imooc.Card@15db9742, com.imooc.Card@6d06d69c, com.imooc.Card@7852e922, com.imooc.Card@4e25154f, com.imooc.Card@70dea4e, com.imooc.Card@5c647e05, com.imooc.Card@33909752, com.imooc.Card@55f96302, com.imooc.Card@3d4eac69, com.imooc.Card@42a57993, com.imooc.Card@75b84c92, com.imooc.Card@6bc7c054, com.imooc.Card@232204a1, com.imooc.Card@4aa298b7, com.imooc.Card@7d4991ad, com.imooc.Card@28d93b30, com.imooc.Card@1b6d3586, com.imooc.Card@4554617c, com.imooc.Card@74a14482, com.imooc.Card@1540e19d, com.imooc.Card@677327b6, com.imooc.Card@14ae5a5, com.imooc.Card@7f31245a, com.imooc.Card@6d6f6e28, com.imooc.Card@135fbaa4, com.imooc.Card@45ee12a7, com.imooc.Card@330bedb4, com.imooc.Card@2503dbd3, com.imooc.Card@4b67cf4d, com.imooc.Card@7ea987ac, com.imooc.Card@12a3a380, com.imooc.Card@29453f44, com.imooc.Card@5cad8086, com.imooc.Card@6e0be858, com.imooc.Card@61bbe9ba, com.imooc.Card@610455d6, com.imooc.Card@511d50c0, com.imooc.Card@60e53b93, com.imooc.Card@5e2de80c, com.imooc.Card@1d44bcfa, com.imooc.Card@266474c2, com.imooc.Card@6f94fa3e, com.imooc.Card@5e481248, com.imooc.Card@66d3c617, com.imooc.Card@63947c6b, com.imooc.Card@2b193f2d, com.imooc.Card@355da254, com.imooc.Card@4dc63996, com.imooc.Card@d716361, com.imooc.Card@6ff3c5b5, com.imooc.Card@3764951d, com.imooc.Card@4b1210ee]