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 6 of 6

Thread: 2d arrays

  1. #1
    Junior Member
    Join Date
    Jul 2012
    Posts
    17
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default 2d arrays

    hey, I was wondering if anybody knows of any good websites or exercises for learning 2d arrays, im studying for my college repeats and one of the main things that will be on the test is a 2d array where i have to right methods for it. I cant seem to get my head around 2d arrays its really frustrating tried google it but didnt get any good tutorials on it.
    kind regards
    J.Fox


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,529
    My Mood
    Hungover
    Thanks
    144
    Thanked 647 Times in 552 Posts

    Default Re: 2d arrays

    Think of 2d arrays as simply an array of arrays (because that's what they are). What has you confused? I'd write some example programs and play around with the concept- the best way to learn how to program is by writing code.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Jul 2012
    Posts
    17
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: 2d arrays

    The whole coordinate shit and how you populate certain areas on you 2d array with integers or characters, like say im doing a sudoku puzle, how the hell do i populate the grid with random numbers in 3x3 sections, stuff like that

  4. #4
    Member
    Join Date
    Jul 2012
    Posts
    90
    Thanks
    1
    Thanked 2 Times in 2 Posts

    Default Re: 2d arrays

    Here is a tutorial i am studying right now.I recommend it.Sure you can find something helpful there
    The Java™ Tutorials

    Good luck with test

  5. #5
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,529
    My Mood
    Hungover
    Thanks
    144
    Thanked 647 Times in 552 Posts

    Default Re: 2d arrays

    Quote Originally Posted by jonathanfox View Post
    The whole coordinate shit and how you populate certain areas on you 2d array with integers or characters, like say im doing a sudoku puzle, how the hell do i populate the grid with random numbers in 3x3 sections, stuff like that
    Like I said, the best way to learn is by coding. Have you actually attempted to write a program that does this?

    I'm not really sure what exactly you mean by coordinates. Like I said, a 2d array is just an array of arrays. So if you have array[x][y], the x index is simply accessing the top-level array (which returns another array). Then the y index is accessing that inner array, and returns whatever type you put into it.

    How you display a 2d array is a different question. So to talk about coordinates, you first have to explain how you're displaying the arrays.

    If you're still confused, write a program that populates a 2d array with all zeros and then changes a specific "coordinate" to a one. Where is that one? What if you move it around in the array?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  6. #6
    Junior Member
    Join Date
    Jul 2012
    Posts
    17
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: 2d arrays

    Cheers bud, once i know how to do 2d arrays i should be fine

Similar Threads

  1. Arrays
    By ruffu054 in forum What's Wrong With My Code?
    Replies: 6
    Last Post: September 8th, 2011, 12:18 AM
  2. Need Help with Arrays
    By zennbang in forum Object Oriented Programming
    Replies: 3
    Last Post: July 31st, 2011, 07:41 AM
  3. arrays
    By dwamalwa in forum Java Theory & Questions
    Replies: 4
    Last Post: November 27th, 2010, 01:44 AM
  4. Arrays
    By mlan in forum Java Theory & Questions
    Replies: 2
    Last Post: February 26th, 2010, 10:23 AM
  5. 2d Arrays
    By mgutierrez19 in forum Collections and Generics
    Replies: 5
    Last Post: October 27th, 2009, 05:08 PM