Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Objects Creating the MVP Counting Scrabble Tiles

error: incomparable types: char and char[]

says they are different data types but have never seen char[] before

full compiler error ./ScrabblePlayer.java:22: error: incomparable types: char and char[] for (char letter2 : letter == tiles.toCharArray()) { ^ Note: JavaTester.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error

1 Answer

Steven Parker
Steven Parker
231,271 Points

A "char" variable holds one single character, but a "char[]" holds an entire array of characters. The latter is the kind of thing the "toCharArray()" method returns.

If you're still stuck and need more specific help, please show your complete code.