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.

Android Build a Simple Android App with Java Basic Android Programming Using the Random Class

Robert Rose
Robert Rose
517 Points

JavaTester.java:66: error: array required, but String found String intAsString = intAsString[randomNumber];

Please help.

1 Answer

akiva grobman
akiva grobman
9,160 Points

If I understood correctly it should be: String[] intAsString = intAsString[randomNumber]; Instead of: String intAsString = intAsString[randomNumber];

akiva grobman
akiva grobman
9,160 Points

You can actually see it in the error message. is says "array required, but String found". that tells you the compiler is looking for an array type but is receiving (finding) a String type. this will generally happen when you define the variable the wrong way or if you pass the wrong variable as a parameter.