array output.

mooo

thecyberninja
Joined
6 Jan 2004
Messages
886
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("============ ****  =============");
            }
         }
      }
   }
 
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
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,623
Latest member
AndersonLo
Back