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 trialAbe Daniels
Courses Plus Student 2,781 Points"Cannot find symbol"
Why am i getting this error?
public static char firstLetter = fieldName.charAt(0);
public static String validatedFieldName(String fieldName) {
return fieldName;
}
1 Answer
Allan Clark
10,810 PointsThat is because on the first line, there is no fieldName variable to call the charAt() method on. That variable only exists inside the method validatedFieldName method.
*Note: when you move the firstLetter variable inside the method remove the modifiers (i.e. public static).
Hope this helps happy coding