Results 1 to 1 of 1
  1. #1
    bronzefish is offline Member
    Join Date
    Dec 2012
    Posts
    7
    Rep Power
    0

    Exclamation help in assigning array index to Strings

    Java Code:
    String[] suits = {"Mr", "Mrs", "Miss", "Master" }; //array of strings
    String[] ranks = {"A", "B", "C", "D", "E", "F", "G", "H", "I","J", "K", "L", "M"}; //array of strings
    String[] job ={ " the Footballer", " the Cricketer"," the Motorist", " the Announcer", " the Boxer", " the Golfer"," the Boatman", " the Photographer", " the Weight Lifter"," the Runner", " the Gardener","the Gamer", "the TechGuy"};
    String[] title ={"", " 's wife", " 's daughter"," 's son"};
    
    public static void DeckCreate(){
    String[] arrayCards = new String[47];
    
    for(int i=0;i<ranks.length;i++)
    	{
    	for(int j=0;j<suits.length;j++)
    	{
    	System.out.println(suits[j]+" "+ranks[i]+", "+job[i]+title[j]);
    	}
    	}

    I am new to java and this forum, forgive me if i did anything wrong.
    i need to put (String a) into the arrCards. There will be 48 results if you do a System.out.println(a). what do you suggest so that i can call arrCards[0] to arrCards[49] and it will give me individual result? or assign the first index of arrCards to the first result and second index of the arrCards to the second result?

    For example, System.out.println(arrayCards[1]); and it will display "Mr A the footballer".

    No arraylist, 2-3D array or any GUI.

    Thanks. your help will be appreciated!!
    Last edited by bronzefish; 12-02-2012 at 03:53 PM.

Similar Threads

  1. Help with while loops
    By enjoy2225 in forum New To Java
    Replies: 9
    Last Post: 10-26-2012, 01:27 AM
  2. Help with loops!
    By jrelvi23 in forum New To Java
    Replies: 9
    Last Post: 09-04-2012, 02:36 PM
  3. Replies: 20
    Last Post: 03-22-2011, 05:02 AM
  4. Replies: 9
    Last Post: 02-14-2011, 05:22 AM
  5. when should we use loops
    By shahemaan in forum New To Java
    Replies: 1
    Last Post: 10-31-2009, 02:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •