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 trialMUZ140117 Walter Moyo
7,289 PointsTeacher Assistant Validation
I must ensure that the first letter of the fieldName is 'm'. Then i must ensure the the second letter of the field name is capitalised.
I am getting a compiler error and clicking preview does not show me where i made a mistake. Please help. Frustration is kicking in
public class TeacherAssistant {
public static String validatedFieldName(String fieldName) {
if(fieldName.charAt(0) !== 'm'){
throw new IllegalArgumentException("First character must be m");
}
if(!Character.isLetter(fieldName.charAt(1)) || !Character.isUpperCase(fieldName.charAt(1)) ){
throw new IllegalArgumentException("Second letter must be capitalised");
}
// These things should be verified:
// 1. Member fields must start with an 'm'
// 2. The second letter in the field name must be uppercased to ensure camel-casing
// NOTE: To check if something is not equal use the != symbol. eg: 3 != 4
return fieldName;
}
}
3 Answers
Saad Anjum
6,408 PointsTook a closer look again and it seems like the !==
operator in the first if
statement might be the culprit. It should be !=
instead:
if(fieldName.charAt(0) != 'm')
Saad Anjum
6,408 PointsWhat is the compiler error that you get?
Iftode Daniel
Front End Web Development Techdegree Student 14,093 Pointshello i get this error when trying to submit my project for grading "Project Validation
There is an issue locating your styles.css file. Check that it has been added to GitHub correctly. If the styles.css file has been renamed or moved to another folder this test will not pass."
i checked and double checked the location of the css file and its all there and i dont know what is wrong please help u can check my project at www.iftodedaniel.com
MUZ140117 Walter Moyo
7,289 PointsMUZ140117 Walter Moyo
7,289 PointsThank you. It finally compiled after removing that extra =
Saad Anjum
6,408 PointsSaad Anjum
6,408 PointsYou are welcome.