This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Char Array Help