63 064
Assignments Done
99,1%
Successfully Done
In July 2018

Answer to Question #63033 in Java | JSP | JSF for mike

Question #63033
Exception in thread "main" java.lang.NumberFormatException: For input string: "J"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:492)
at java.lang.Integer.parseInt(Integer.java:527)
at bear.read(bear.java:34)
at bear.main(bear.java:15)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
Expert's answer
The Integer.parseInt(String s) method works normally only with string representation of integers without spaces and indents. When this method takes incorrect argument, it will throw NumberFormatException.
For example:
Integer.parseInt(β€œ123”); - correct, will return 123;
Integer.parseInt(β€œone”); - incorrect, will throw NumberFormatException.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions