How to convert "22" (String) to 22 (integer) in Java ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

How to convert "22" (String) to 22 (integer) in Java ?

I want get user Input in integer but it always get in string so I decided to convert it into a int but I don't know how to do that so I expect that somebody will help me from the Sololearn Help plzz

12th Apr 2020, 6:54 PM
Abhay
Abhay - avatar
2 Answers
+ 3
Abhay This is one of the reasons we recommend users to learn from other sources as well because the courses on sololearn helps you to get acquainted with the language but there are other important concepts that you need to learn by yourself. One more possibility- String str = "22"; int num = Integer.valueOf(str);
12th Apr 2020, 7:08 PM
Avinesh
Avinesh - avatar
- 1
This is not available in Sololearn
12th Apr 2020, 7:08 PM
Abhay
Abhay - avatar