Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-05-2007, 06:07 PM
Java Tip's Avatar
Moderator
 
Join Date: Nov 2007
Posts: 1,691
Rep Power: 5
Java Tip will become famous soon enoughJava Tip will become famous soon enough
Default Multidimensional arrays
Multidimensional arrays are very useful while programming. Matrix operations become easier when using arrays.

Code:
String[][] array = new String[2][4];
for (int row=0;row<2;row++)
{
	for (int col=0;col<4;col++)
		array[row][col] = "Value at row: " + row + " col: " + col;
}
		
for (int row=0;row<2;row++)
{
	for (int col=0;col<4;col++)
		System.out.println(array[row][col]);
}
Output:
Code:
Value at row: 0 col: 0
Value at row: 0 col: 1
Value at row: 0 col: 2
Value at row: 0 col: 3
Value at row: 1 col: 0
Value at row: 1 col: 1
Value at row: 1 col: 2
Value at row: 1 col: 3
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Arrays bunbun New To Java 1 04-09-2008 03:24 AM
new to arrays jimJohnson New To Java 1 04-08-2008 03:45 PM
2D-Arrays kbyrne New To Java 1 02-07-2008 11:08 PM
arrays help Warren New To Java 6 11-23-2007 08:23 PM
Problems with arrays Marcus New To Java 2 07-04-2007 09:10 AM


All times are GMT +2. The time now is 04:40 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org