JavaRanch » Java Forums »
Java »
Beginning Java
| Author |
Char Array Help
|
Derek Boring
Ranch Hand
Joined: Aug 15, 2006
Posts: 57
|
|
I'm making a simple game that uses character arrays as the maps. here's what i have: key: x = wall b = building w = well s = store t = tavern l,j,f,m = doors to other maps it tells me that me this: illegal initializer for char i don't know why it's telling me this. any and all help is greatly appreciated. thanks guys.
|
Life is 10% what happens and 90% how you react to it.
Attitude is everything.
|
 |
Keith Lynn
Ranch Hand
Joined: Feb 07, 2005
Posts: 2341
|
|
|
What you have on the right is an array of array of chars, so you need to modify the reference type.
|
 |
marc weber
Sheriff
Joined: Aug 31, 2004
Posts: 11343
|
|
Originally posted by Keith Lynn: What you have on the right is an array of array[s]...
In other words, what Java calls a "multi-dimensional" array.
|
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
|
 |
Mike Mc Afee
Greenhorn
Joined: Jan 31, 2007
Posts: 19
|
|
Originally posted by Derek Boring:
If you google "java multidimensional array" you'll find what you need. [ March 06, 2007: Message edited by: Mike Mc Afee ]
|
 |
Justin Fox
Ranch Hand
Joined: Jan 24, 2006
Posts: 802
|
|
wouldn't it be char[][] = etc.. ? Justin
|
You down with OOP? Yeah you know me!
|
 |
Derek Boring
Ranch Hand
Joined: Aug 15, 2006
Posts: 57
|
|
|
Thanks guys. i can't believe i made such a simple mistake!
|
 |
 |
|
|
subject: Char Array Help
|
|
|
|