Debug your program, and watch the value returned by name = reader.nextLine(); Maybe it's a null, and in the validation method, you test only for "". Try to test for length for example: if...