array output.

Discussion in 'Web Design & Coding' started by mooo, Mar 21, 2005.

  1. mooo

    mooo thecyberninja

    Messages:
    886
    Location:
    earth
    I am lost on this output i am trying to do to test. I had this damn program running atleast this afternoon but didn't have inet to email to myself so i had to print, now something is messed up
    the system.out.print(multiArray) is where it is messed up saying it can't find symbol for or [j]

    Code:
        public class LatinSquares
       {
       
           static private class arrays
          {
             int [][]a;
              public arrays(int size)
             {
                a = new int [size][size];
             }
          }//END OF ARRAYS
           public static void main(String [] oo)
          {
             int size = 3;
             arrays [] multiArrays = null;
             if (size<2)
                System.out.println("**BAD DATA**");
             else
                if (size ==2)
                   multiArrays = new arrays[size];
                else 
                   if (size ==3)
                      multiArrays = new arrays[size*4];
                   else 
                      if (size > 3)
                         System.out.println("***DATA TOO LARGE***");
             if (multiArrays != null)
             {
                for (int k = 0; k <size; k++)
                   multiArrays[k] = new arrays(size);
                for (int k =0;  k< size; k++)
                   for (int j = 0; j <multiArrays[k].a.length; j++)
                      for (int i = 0; i <multiArrays[k].a.length; i++)
                         multiArrays[k].a[i][j] = k+1;
                for (int k = 0; k < size; k++)
                {
                   for (int j=0; j < multiArrays[k].a.length; j++);
                   {
                      for (int i=0; i < multiArrays[k].a.length; i++);
                      {
                         System.out.print( multiArrays[k].a[i][j] + " - "); 
                      }	
                      System.out.println();
                   }
                   System.out.println("============ ****  =============");
                }
             }
          }
       }
    
    
     
  2. Geffy

    Geffy Moderator Folding Team

    Messages:
    7,805
    Location:
    United Kingdom
    Lines 21 and 24 you should probably be using () and not []

    also the two-dimensional array in class arrays probably needs to be marked as public for you to access it, unless I have forgotten an aspect of inner classes