1 Replies - 10937 Views - Last Post: 30 April 2008 - 05:19 PM Rate Topic: -----

#1 mrcub1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 30-April 08

2D Char Arrays

Post icon  Posted 30 April 2008 - 04:19 PM

I want to make a 2d array with the parameters of 10x10 and populate it with a's b's and whitespace's but i cant figure out how to populate the array with char's. I know i need a for loop to fill the array completly up but i'm just tring to partially fill it to see if i can get the program to display anything. Can Someone Help Me?
Thank You
public class TryAtGrid
{
   public static void main(String[] args)

	char [][] a = new char [10][10];
   //Thought you could add in the array by
   //a[1][4]=a;
   //a[2][1]=b;
   //a[2][4]=' '; ect.. but has not worked for me
	int row, column;
	for (row = 0; row < 10; row++)
	{
		for (column = 0; column < 10; column++)
			System.outprint(a[row][column]);
		System.out.println();
	}
}



Is This A Good Question/Topic? 0
  • +

Replies To: 2D Char Arrays

#2 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8315
  • View blog
  • Posts: 31,836
  • Joined: 06-March 08

Re: 2D Char Arrays

Posted 30 April 2008 - 05:19 PM

You mean
with the quote ''
withour the quote you where saying that a[1][4] was supposed to contain the array a
public class TryAtGrid
{
   //Thought you could add in the array by
   //a[1][4]='a';
   //a[2][1]='b';
   //a[2][4]=' '; ect.. but has not worked for me


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1