Hi Stephen,

 

You have made a logical error that makes your Loops infinite

 

You can see the difference between my code and yours

 

My code

 

for(int counterROW=0; counterROW<row_length; counterROW++) {

 

     for(int counterCOL=0; counterCOL<col_length; counterCOL++) {

 

         for(int counterVer=0; counterVer<ver_length; counterVer++) {

 

            SpacePoint[counterROW][counterCOL][counterVer] =
counterROW+counterCOL+counterVer ;

System.out.print( SpacePoint[counterROW][counterCOL][counterVer] ) ; 

         

     }}}

 

Your code

 for(int counterROW=0;counterROW<row_length;row_length++){
     for(int counterCOL=0;counterCOL<col_length;counterCOL++){
         for(int counterVer=0;counterVer<ver_length ; ver_length++){
 
SpacePoint[counterROW][counterCOL][counterVer]=counterROW+counterCOL+counter
Ver;
          System.out.print(SpacePoint[counterROW][counterCOL][counterVer]); 
         
     }}}



Hope I helped

A.S.El-Dalatony

  _____  

From: javaprogrammingwithpassion@googlegroups.com
[mailto:javaprogrammingwithpass...@googlegroups.com] On Behalf Of Stephen
Adjei
Sent: Friday, January 30, 2009 10:50 PM
To: javaprogrammingwithpassion@googlegroups.com
Subject: [java programming] multi dimentional array

 

I run this code and it didnt print out anything but froze my machine:
why.does that mean home pc's cant process three D arrays

public class Trial {

    public Trial() {
    }
  public static void main(String[] args){
 int row_length =4;
 int col_length =3;
 int ver_length =2;
 
 int SpacePoint[][][]= new int[row_length][col_length][ver_length];
 
 
 for(int counterROW=0;counterROW<row_length;row_length++){
     for(int counterCOL=0;counterCOL<col_length;counterCOL++){
         for(int counterVer=0;counterVer<ver_length ; ver_length++){
 
SpacePoint[counterROW][counterCOL][counterVer]=counterROW+counterCOL+counter
Ver;
          System.out.print(SpacePoint[counterROW][counterCOL][counterVer]); 
         
     }
 }
 
 
  }
  
  
 }

I need some help on three dimensional array






--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to javaprogrammingwithpassion@googlegroups.com
To unsubscribe from this group, send email to 
javaprogrammingwithpassion-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to