I want to display different string array elements like this:
- Clubs 1
- Hearts Ace
- Diamonds 9
CardGame.java:
public class CardGame { public static void main(String[] args){ String[] suit = { "Clubs", "Hearts", "Diamonds", "Spades" }; String[] deck = { "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King", "Aces" }; int i = (int) ( Math.random() * deck.length ); int j = (int) ( Math.random() * suit.length ); for( int a = 0; a < 7; a++ ) { System.out.println( "Deck " + deck[i] + " Suit " + suit[j] ); } System.out.println(); } } How will I do it? Point me to correct logic of displaying those different elements. Thanks.
iandj. How do you expect what you're printing to change ifiandjdon't change? (Also note that your arrays are misnamed. The suits are hearts, clubs, diamonds and spades...