Home » Interview » Technology

try { int x = Integer.parseInt("two"); } Which could be used to create an appropriate catch block?

Correct Answer: NumberFormatException

Explanation:

C is correct. 'Integer.parseInt' can throw a NumberFormatException, and IllegalArgumentException is its superclass 


← Previous Question Next Question→

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion