Question 14
Back to Exercise
What is the difference between Integer.parseInt(s) and Integer.valueOf(s)?
- A None
- B parseInt returns a primitive int; valueOf returns an Integer object Correct
- C valueOf throws no exceptions
- D parseInt works only for hex
Correct Answer: Option B
Both throw NumberFormatException for invalid text.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!