Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
1.3k views
in Programming by
recategorized by
I am given a string (100.0). I need to convert that to int. How do I do that?

When I do Integer.parseInt(). I am getting below error.

java.lang.NumberFormatException: For input string: "100.0"

1 Answer

0 like 0 dislike
by
 
Best answer

You can achieve this by using java.lang.Double class

 

Double valueToDouble = Double.parseDouble("100.0");
int valueint = valueToDouble .intValue();


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

...