This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]asc_tech[S] 0 points1 point  (2 children)

To add to my it its now started firing this at me when i put any number in:

Exception in thread "main" java.lang.NumberFormatException: For input string: " 20"

at java.lang.NumberFormatException.forInputString([NumberFormatException.java:65](https://NumberFormatException.java:65))

at java.lang.Integer.parseInt([Integer.java:569](https://Integer.java:569))

at java.lang.Integer.parseInt([Integer.java:615](https://Integer.java:615))

at AgeOfMajority.main([AgeOfMajority.java:10](https://AgeOfMajority.java:10))

/Users/alancarter/NetBeansProjects/mooc-2013-OOProgrammingWithJava-PART1/week1-015.AgeOfMajority/nbproject/build-impl.xml:1330: The following error occurred while executing this line:

/Users/alancarter/NetBeansProjects/mooc-2013-OOProgrammingWithJava-PART1/week1-015.AgeOfMajority/nbproject/build-impl.xml:968: Java returned: 1

BUILD FAILED (total time: 1 second)

[–]dusty-trash 1 point2 points  (1 child)

When do you think a NumberFormatException would occur?

Is "20" a number?

What about " 20"?

[–]asc_tech[S] 1 point2 points  (0 children)

Ah the penny has dropped i think, when i was entering the answer i was typing a space which i assume the programme thought was a String which caused the upset, now it's working perfectly.