0

Whenever I run int it says type mismatch: cannot convert from string to int

I m kind of new so plz

14th Jul 2016, 10:21 PM
romit chahar
romit chahar - avatar
3 Réponses
+ 3
You are assigning String value to int. You can't type cast String to int. If you want to write like this. int x=Integer. parseInt("58");
15th Jul 2016, 5:35 AM
Dilip Belgumpi
Dilip Belgumpi - avatar
+ 1
use Integer wrapper class to get int from string for eg int a = Integer.parseInt("your_string"); check out more wrapper classes at javamidpoint.wordpress.com
15th Jul 2016, 5:35 AM
Hardeep Bhardwaj
Hardeep Bhardwaj - avatar
0
tq
1st Sep 2016, 4:51 AM
Prashanth