My name is Chris! To help improve my java programming skills, I'm trying to make a deck class which is an array of cards, however when printing the constructor for the deck class, I get the constructor name and a time stamp and I am COMPLETELY clueless as to why this is.
Can you help?
public static void main(String args[])
{
System.out.println("Custom Java Card Game- Chris L.");
System.out.println();
Deck deck = new Deck();
deck.addCards();
System.out.println();
System.out.println(deck);
}
That is the code from the main program and here is the deck class:
public Deck() //Deck is an array of cards
{
size = 52;
cards = new Card[size]; //Array of cards up to 52
// addCards();
}
public void addCards(){
for(int k = 0; k < Slength; k++){
for (int m = 0; m < Rlength; m++){
String s = suite[k];
String n = num[m];
int r = rank[m];
String str = Integer.toString(r);
// String fin = "[" + s + "," + n + "," + str + "] \r";
// System.out.print(fin);
Card card0 = new Card(s,n,r); //Makes a card! IS WORKING!
turntoString(card0);
// System.out.println( turntoString(card0) );
cards[k] = card0; //adds card to array! IS WORKING!
// System.out.println(cards); //card0
System.out.println(turntoString(card0));
}
}
and here is the output:
deck.Deck@1f01b29
Can anybody explain to me why this is?