Ok so here is the deal I am attempting to take data entered from the keyboard in the format MM dd yyyy with the whitespace. Example:12 28 1973
I am becoming very frustrated because I keep receiving this error
Exception in thread "main" java.text.ParseException: Format.parseObject(String) failed
Java Result: 1
If someone could help me I would greatly appreciate it. Thank you
You do need to input a valid date in the correct format otherwise it will throw an Exception. And in your case you provided an empty String which is probably caused by just pressing enter instead of entering a date.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
posted 9 years ago
I am not sure I understand what you mean.
I need the scanner to read user input not a predefined string which I specify.
Thank you for your time.
Exception in thread "main" java.text.ParseException: Unparseable date: ""
This error means that you are passing an empty string to your parser, just as
Exception in thread "main" java.text.ParseException: Unparseable date: "201010101"
Would mean you had given it a garbage date.
Is your scanner working properly?, maybe you can try printing the birthDayString back to yourself after you read it in to confirm that it is as you were expecting.
You're on a gravy train with biscuit wheels Roy.
posted 9 years ago
I am at a loss here.
To try to see if the scanner is working properly I have edited my program as shown below.
The problem is in the out put it skips over entering the birthday all together The output looks like this
Please enter your name:
Please enter your weight in lbs:
Please enter your birthdate in the format mm dd yyyy
BUILD SUCCESSFUL (total time: 4 seconds)
Thank you again for all of your help I appreciate it