Results 1 to 4 of 4
  1. #1
    newstart is offline Member
    Join Date
    Jul 2010
    Posts
    4
    Rep Power
    0

    Default java arrays need help

    hello i was wondering if anyone had any good website on creating 2D arrays as i dnt no how to hold values into one

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    When I Googled -- java 2d array -- the first and third hit (the second is simply the 2nd page of the first hit), looked decent enough to get you started.

    Luck.

  3. #3
    newstart is offline Member
    Join Date
    Jul 2010
    Posts
    4
    Rep Power
    0

    Default

    hey thanks am tryin to hold 3 lines of values into a 2D array would i do this by
    import java.util.*;

    public class array{
    public static void main(String[] args){
    int num[] = { {50,20,45,82} {25,63,10,16} {12,3,45,82} };

    or sumfing like this

    int array1 [] {50,20,45,82}
    int array2 [] {25,63,10,16}
    int array3 [] {12,3,45,82}

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,790
    Rep Power
    25

    Default

    Have you tried asking the compiler what it thinks about your code? You'll often get a quicker response than waiting for someone on a forum.

    Correct the first by adding another set of [] and some commas

    int num[][] = { {50,20,45,82}, {25,63,10,16}, {12,3,45,82} };
    Last edited by Norm; 07-24-2010 at 01:44 AM.

Similar Threads

  1. Java Phonebook With Arrays // HELP! //
    By K-Scale in forum New To Java
    Replies: 9
    Last Post: 10-04-2011, 04:41 AM
  2. Arrays.sort... why sorting all arrays in class?
    By innspiron in forum New To Java
    Replies: 6
    Last Post: 03-23-2010, 02:40 AM
  3. java arrays
    By miko5054 in forum New To Java
    Replies: 15
    Last Post: 03-18-2010, 06:17 PM
  4. arrays in java
    By mayhewj7 in forum New To Java
    Replies: 4
    Last Post: 12-17-2008, 04:48 AM
  5. Arrays in Java
    By hiranya in forum New To Java
    Replies: 3
    Last Post: 07-30-2007, 10:10 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
  •