Forum : need assistance on multidimension char array
Brief description  about Online courses   join in Online courses
View Leepika  Mukherjee 's Profile

need assistance on multidimension char array

Hi Sir,

I am unable to sort out the error. Kindly help me in the program below for displaying multidimensional char array :-

class CharArray
{
public static void main(String ar[])
{

char ca=new char[2][2];
ca[0][0]='a';
ca[0][1]='b';
ca[1][0]='c';
ca[1][1]='d';

for(int i=0;i<ca.length;i )
{
for(int j=0;j<ca[i].length;j )
{
ca[i][j]=(char)i;
System.out.print(a[i][j]);
}
System.out.println("");
}
}
}
Asked by Leepika Mukherjee | Mar 24, 2011 |  Reply now
Replies (1)
View arun kumar das 's Profile
Hi,

Please check the code and try to find your mistake.

class CharArray
{
public static void main(String ar[])
{
char ca[][]=new char[2][2];
ca[0][0]='a';
ca[0][1]='b';
ca[1][0]='c';
ca[1][1]='d';

for(int i=0;i<ca.length;i++)
{
for(int j=0;j<ca.length;j++)
{
//ca[i][j]=(char)i;
System.out.print(ca[i][j]+" ");
}
System.out.println("");
}
}
}

java teacher
Mar 31, 2011