Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: need two dimensional array help..

  1. #1
    Junior Member
    Join Date
    Jan 2013
    Posts
    8
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default need two dimensional array help..

    If i have two arrays like the suit and number array below, how can i make a two dimensional array using String values that are like the ones stored in "suit" and "number"?




    String[] suit = {"Spade", "Hearts", "Clubs", "Diamonds"};
    String[] number = {"Ace","2","3","4","5","6","7","8","9","10","Jack" ,"Queen","King"};
    String[][] cardDeck = new String[4][13];
    for(int z = 0; z<= suit.length; z++)
    {
    for(int y = 0; y<= number.length; y++);
    {
    cardDeck = [suit[z]][number[y]];
    }
    }


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: need two dimensional array help..

    how can i make a two dimensional array
    Here's a sample 2 dim array:
    String[][] twoD = {{"asd", "err"}, {"d's", "43"}};
    If you don't understand my answer, don't ignore it, ask a question.

  3. The Following 2 Users Say Thank You to Norm For This Useful Post:

    18107 (January 19th, 2013), mmagyar14 (January 17th, 2013)

Similar Threads

  1. Converting Two dimensional array into an Array list
    By NewbieJavaProgrammer in forum Object Oriented Programming
    Replies: 11
    Last Post: September 29th, 2012, 04:23 PM
  2. Help with looking through a two-dimensional array.
    By aesguitar in forum Algorithms & Recursion
    Replies: 14
    Last Post: June 1st, 2012, 11:10 AM
  3. Help with one-dimensional array
    By brandon66 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: April 26th, 2012, 04:59 PM
  4. [SOLVED] 2 dimensional array storing help!
    By jts0541 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 31st, 2012, 03:31 PM
  5. Two-dimensional boolean array?
    By tcmei in forum What's Wrong With My Code?
    Replies: 2
    Last Post: May 17th, 2011, 08:32 PM