• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Multi Dimensional Array

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
int[][] multiAnonymousArray = new int[][]{new int[]{23,6667,85,42},new int[]{15,87,65,787,877,65},new int []{54,78,787,51,54,32,56},new int[]{0,205,454,454,5847,4305}};

for(int i = 0; i < multiAnonymousArray.length; i++){
for(int j = 0; j < 4 ; j++){// out of bounds exception if j < 5

System.out.print(multiAnonymousArray[j]);
System.out.print("\t");

}
System.out.print("\n");
}

[I]For the code mentioned above,
I am getting the output as


2366678542
158765787
547878751
0205454454


But,
I have to get the output as
2366678542
158765787877 65
54787875154 32 56
02054544545847 4305


Why I am not able to get my output

Is there any other way to get my output
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can do it as follows:
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Pradeep B",
Please check your private messages regarding an important administrative matter.
-Ben
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic