This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma 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

Char Array Help

Derek Boring
Ranch Hand

Joined: Aug 15, 2006
Posts: 65
I'm making a simple game that uses character arrays as the maps. here's what i have:

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

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
Mike Mc Afee

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..



You down with OOP? Yeah you know me!
Derek Boring
Ranch Hand

Joined: Aug 15, 2006
Posts: 65
Thanks guys. i can't believe i made such a simple mistake!
Have you checked out Aspose?
subject: Char Array Help
It's not a secret anymore!