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 trialJacob Wingfield
7,780 PointsMy code ain't working and I'm not sure why. When I run it in javac it returns a bunch of errors and I don't what's wrong
public class Explore {
public static void main(String[] args) {
String[] friends ={"Ben","Alena","Pasan"};
int[][] scoreCards = {
// Ben's
{1, 2, 4, 2, 6, 5, 4, 3, 3, 2, 5, 7, 2, 7, 8, 4, 3, 2}
// Alena's
{2, 3, 5, 1, 1, 2, 3, 1, 1, 2, 4, 1, 3, 3, 2, 6, 3, 2}
// Pasan's
{4, 4, 2, 1, 2, 2, 1, 4, 2, 2, 2, 3, 2, 5, 8, 1, 2, 2}
};
// for each friend
for (int i = 0; i < friends.length; i++) {
System.out.printf("%s %n--------------------%n",
friends[i]);
for (int j = 0; j < scoreCards[i].length; j++) {
System.out.printf("Hole #%d: %d %n",
j + 1,
scoreCards[i][j]);
}
}
}
}
1 Answer
Steven Parker
231,268 PointsIt looks like the commas that should separate the inner arrays within scoreCards are missing.
Jacob Wingfield
7,780 PointsJacob Wingfield
7,780 PointsThanks