Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 ArrayList help :s
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Fasih




PostPosted: Wed May 18, 2011 7:05 pm   Post subject: ArrayList help :s

Ok so arraylist has got me pegged because I have an assignment about ArrayList and I don't get them.

I have an ArrayList of objects, each is initialized with a value, which is the card number. The code to determine what the suit is is done in the other class. There are some things I don't understand how to do.

Do I have to make the arraylist a constructor or can I just declare it like:

code:
public ArrayList<Cards> deck = new ArrayList <Cards>();




How would I go about randomizing the order at which the deck is displayed? I send each card in the array to another class that loads and draws the image, but how would I "shuffle" the array? Would I have to use an array of int and use Math.random to get numbers, and then send it specifically?
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: