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 trialMichel Spaniolo
Courses Plus Student 1,850 Pointsi keep getting an error in jshell when i run the random function and i cant see what it is
https://w.trhou.se/dgcgk36lnv i get an error when i try to run the random function in jshell. Im not quite sure what the error is refering to..
1 Answer
Steven Parker
231,236 PointsI assume you were compiling "scratch.java", so looking at the error:
scratch.java:4: error: class, interface, or enum expected
String[] friends={
^
You can see it is pointing to a String declaration and complaining that it was expecting a class (or something similar). A Java variable must belong to some class, but this one (and the following one) does not. Did you perhaps intend to have them as part of a "main" class?