Facing something weird with one method of my class
numHands=2; cardsPerHand=2; hand is an ArrayList
public String[] cardToImage(){
String[] cards = new String[numHands*cardsPerHand];
int c = 0;
for (int i=0; i < numHands; i++){
System.out.println("For i = "+i);
for (int x=0; x < cardsPerHand; x++){
System.out.println("For x = "+x);
cards[c]=hand.get(x).toString()+".jpg";
c++;
}
}
return cards;
}
RESULT:
For i = 0 For x = 0 For x = 1 For i = 1 For x = 0 For x = 1 [COLOR="#FF0000"]<-----[/COLOR] For i = 0 For x = 0 For x = 1 For i = 1 For x = 0 For x = 1
Also, how I can use the returned cards to another class and gain access to a specific element?
Thank you
Edited by toto_7, 12 August 2011 - 03:36 AM.


Sign In
Create Account


Back to top









