I want to create a method that is meant to protect against entering a wrong value for gender.

The method fineGender below, will return true if the correct gender is entered and false otherwise.

// postcondition:  fineGender returns true if argument g equals M, m, F or f 
// and returns false otherwise.
    public static boolean fineGender(char g)

So, code it and then post it here if it doesn't work as defined - we don't do your homework for you...

hint: use simple if else or case conditions for the method or use regEx if you want to deviate from the norm a bit :)

an easier implementation would be to make a:

isMale()

method, that returns true if the gender == m or M, false otherwise, that way you don't have to validate the input, neither.

Use regular expression and check for these values rather than using if-else:-

Pattern pattern = Pattern.compile("[MmFf]");
Matcher matcher = pattern.matcher(input);

Learn more about regular expression.

bit of overkill when we're just trying to compare a single char to four possible values, isn't it?