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 trialChidiebere Ekennia
5,950 PointsI don't know what is wrong with my code, especially the "array":
Here's the code:
import java.io.Console;
import java.util.Random;
public class BranchingStatements {
public static void main(String[] args) {
Console console = System.console();
Array [] Rsvps = {"Eric Bailey", "Warren Buffet", "George Michaels", "Lawrence Sheinfield", "Bruce Willis", "Ryan Gosling"};
String [] rsvps = Rsvps.shuffled();
int prizesGivenAway = 0;
int drawingNumber = 0;
while (prizesGivenAway < 5) {
String winner = rsvps [drawingNumber];
drawingNumber++;
//console.printf("is %s present? ", winner);
String isHere = console.readLine("is %s present? ", winner);
if (isHere.equalsIgnoreCase("no"))
continue;
}
String size = console.readLine("What is your shirt size? ");
prizesGivenAway++;
}
}
Error:
BranchingStatements.java:9: error: cannot find symbol
Array [] Rsvps = {"Eric Bailey", "Warren Buffet", "George Michaels", "Lawrence Sheinfield", "Bruce Willis", "Ryan Gosling"};
^
symbol: class Array
location: class BranchingStatements
1 error
Mod Edit: Fixed code formatting - see comment for how to do this yourself!
rydavim
18,814 Pointsrydavim
18,814 PointsWhen posting code, there is some markdown you can use to make it more readable. If you wrap your code in three back-ticks you'll get special formatting, and you can optionally add the language for fancy syntax highlighting.
// Your code here!