Convert string to integer in java
lang_of_article_differ
want_proper_trans
When you got a value from a user for example in a form of a string but it contains numerical value you can use
Integer.parseInt()
method to convert a String
to int
:
String productPrice = "499";
int parsedPrice = Integer.parseInt(productPrice);
System.out.println(parsedPrice);
will output in the follow :
499