Total members 11838 |It is currently Thu Dec 03, 2020 12:45 pm 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     -  
 How can i display these items in Listview in C#?     -  
 Can I display same vertically on right side?     -  
 Display images on jsp from servlet     -  
 Display a different image for each day of the week     -  
 Need Java program for display the CPU usage     -  
 display code block using html     -  
 display the content of text file     -  



Topic Tags

Java Arrays






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