Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
218,692 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.