File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Char Array Help Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Char Array Help" Watch "Char Array Help" New topic
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!
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Char Array Help
 
Similar Threads
Math.Random() query
Brute Force
Dsplaying the alphabet with a loop?
Finding the index of a character in an array
toUpper, toLower for chars