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

Android

whats wrong

this is what I wrote:

String[] sports = { "soccer" "hockey"
"football" };

but this is what it said:

Bummer! There is a compiler error. Please click on preview to view your syntax errors!

this is what the preview says:

JavaTester.java:65: error: '}' expected "soccer" ^ JavaTester.java:67: error: not a statement "football" ^ JavaTester.java:67: error: ';' expected "football" ^ JavaTester.java:72: error: expected taskNumber = 1; ^ JavaTester.java:73: error: illegal start of type if (sports instanceof String[]) { ^ JavaTester.java:73: error: expected if (sports instanceof String[]) { ^ JavaTester.java:73: error: ';' expected if (sports instanceof String[]) { ^ JavaTester.java:73: error: illegal start of type if (sports instanceof String[]) { ^ JavaTester.java:73: error: expected if (sports instanceof String[]) { ^ JavaTester.java:73: error: ';' expected if (sports instanceof String[]) { ^ JavaTester.java:88: error: illegal start of type } else { ^ JavaTester.java:88: error: ';' expected } else { ^ JavaTester.java:89: error: invalid method declaration; return type required fail("Make sure you're declaring the array properly as an array of Strings."); ^ JavaTester.java:89: error: illegal start of type fail("Make sure you're declaring the array properly as an array of Strings."); ^ JavaTester.java:94: error: class, interface, or enum expected } ^ JavaTester.java:98: error: class, interface, or enum expected } ^ JavaTester.java:102: error: class, interface, or enum expected } ^ 17 errors

how do I get this to work?

1 Answer

Hi breckconley,

I don't know what code challenge this is from so I don't know what the exact instructions are but you're missing commas after "Soccer" and "Hockey" to separate the array items.

Post the code challenge if you're still stuck so we can see the instructions.