What happens in Integer.parseInt() if the thing you pass isn't a number? And does it recognize spelled-out numbers, like "three" ?

Questions by krishna_darl   answers by krishna_darl

Showing Answers 1 - 2 of 2 Answers

kalya

  • May 22nd, 2006
 

if the passed object can be converted to an int, it will be converted. (ex. "1234"). Otherwise a NumberFormatException will be thrown.

  Was this answer useful?  Yes

Seetha Ram Janapala

  • May 22nd, 2006
 

Integer.parseInt() method throws a NumberFormatException if any data other than the number (within the range of java ?int? data type) is passed as argument, even when we pass spelled-out numbers, like "three".

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.