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 trial

Java Java Objects (Retired) Delivering the MVP Validation

Kevin McFarland
Kevin McFarland
5,122 Points

What exactly is the extent of "Delivering the MVP" challenge in Java Objects Stage 4?

Here's the Task...

Challenge Task 1 of 1

So I was wondering if you could help me with some of these code challenges. As you might've seen when a member field name doesn't match the style we've talked about, I send an error about it. Let's write some code to validate the style of the field name.

I've added the method validatedFieldName it will return the validated field name. If the value passed in doesn't meet the requirements, throw an IllegalArgumentException. I'll keep you posted on the results every time you press check work.

Code Challenge

public class TeacherAssistant {

  public static String validatedFieldName(String fieldName) {

    // 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;


I'm having a hard time ascertaining the extent of the code challenge.

Are we being ask to iterate over fieldName - checking for lowercase first letter("m"), uppercase second letter and then lower case on all subsequent letters within fieldName?

Throwing exceptions in each case if not validating true?

Or am I over thinking the process?



1 Answer

Tulio Albuquerque
Tulio Albuquerque
12,676 Points

you are been ask to see if the first letter is 'm' and if the second letter is uppercase, if one of those is false you throw the exception.