Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Java
class myclass{
	public static void main(String args[]){
	char array[][]=new char[3][3];
        array[][]={{'1','2','3'},{'4','5','6'},{'7','8','9'}};
	
        }
}

please explain me these errors and error are:
myclass.java:4: error: not a statement
array[][]={{'1','2','3'},{'4','5','6'},{'7','8','9'}};
^
myclass.java:4: error: ';' expected
array[][]={{'1','2','3'},{'4','5','6'},{'7','8','9'}};
^
myclass.java:4: error: not a statement
array[][]={{'1','2','3'},{'4','5','6'},{'7','8','9'}};
^
myclass.java:4: error: ';' expected
array[][]={{'1','2','3'},{'4','5','6'},{'7','8','9'}};
^
myclass.java:4: error: illegal start of expression
array[][]={{'1','2','3'},{'4','5','6'},{'7','8','9'}};
^
myclass.java:4: error: not a statement
array[][]={{'1','2','3'},{'4','5','6'},{'7','8','9'}};
^
myclass.java:4: error: ';' expected
array[][]={{'1','2','3'},{'4','5','6'},{'7','8','9'}};
^
myclass.java:4: error: illegal start of expression
array[][]={{'1','2','3'},{'4','5','6'},{'7','8','9'}};
^
myclass.java:4: error: not a statement
array[][]={{'1','2','3'},{'4','5','6'},{'7','8','9'}};
^
myclass.java:4: error: ';' expected
array[][]={{'1','2','3'},{'4','5','6'},{'7','8','9'}};
^
10 errors
Posted
Updated 28-Nov-15 0:40am
v2
Comments
phil.o 28-Nov-15 6:04am    
There is nothing to correct, since you did not explain any issue.
And you cannot avoid doing your homework by asking us to do it for you.
Patrice T 28-Nov-15 6:04am    
This is your HomeWork, not our's.

Try to read about arrays and get an understanding about the topic.
There is plenty of online material you can use.

Examples:
The Java™ Tutorials: Arrays[^]

Beginning JAVA: Arrays[^]

Multidimensional Arrays[^]

If you check out the links above you might actually learn something. :-)
 
Share this answer
 
No.
Firstly because we don't know what it should do, secondly because it doesn't do anything, and thirdly because we do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900