Quote (carteblanche @ Nov 18 2013 11:22pm)
InvalidArgument or a custom one that inherits RuntimeException
or go the lazy way and throw NullPointerException
the user isn't going to see it regardless. i imagine you'll catch it and show a nice error message.
right now I have this:
Code
System.out.print("Enter in the course name: ");
String courseName = s.nextLine();
while(courseName.equals("")){
System.out.println("You must enter a course name.");
System.out.print("Enter in the course name: ");
courseName = s.nextLine();
}
But the requirements for my project says I must use exception handling.
my program works the way it is and makes the user enter in something and not just press enter, i am just confused how to throw this exception if it isn't usually caught by the computer anyways.
I know how to throw NumberFormatExceptions