Total members 11895 |It is currently Sun Dec 22, 2024 4:16 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Now .
IF you have multi-D (2D) Array of Strings you can do the following with out writing the size every time you display 2d array , Just make a Function and pass the 2d array to it as a parameter.

java code
for(int i=0;i<arr.length ;i++) 
{ System.out.print("| ");
for(int j=0;j<arr[0].length;j++)
{ System.out.print(arr[i][j]+" "); }
System.out.println("| "); }


another improvement :mrgreen:
java code
for(String[] i:arr)
for(String j:i)
System.out.print(j+" ");




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Here is how to display any 2d array
 Array difference for associate array     -  
 display list     -  
 SEVEN SEGMENT DISPLAY     -  
 Can I display same vertically on right side?     -  
 Display images on jsp from servlet     -  
 Display a different image for each day of the week     -  
 How can i display these items in Listview in C#?     -  
 display code block using html     -  
 display the content of text file     -  
 read php file in asp and display it as html     -  



Topic Tags

Java Arrays
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com