This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Char Array Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Char Array Help" Watch "Char Array Help" New topic
Author

Char Array Help

Derek Boring
Ranch Hand

Joined: Aug 15, 2006
Posts: 63
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: 2367
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: 63
Thanks guys. i can't believe i made such a simple mistake!
 
GeeCON Prague 2014
 
subject: Char Array Help