0
can anyone give me the code snippet for this question..
to get a numbers as a string, and save those in integers. ex: char str[2]={"13,6,5"}; int a,b,c; output // a=13 b=6 c=5 we muat give input in the form of {"13,6,5"}
1 Answer
+ 2
Use Integer.parseInt to convert string number to interger.
String[] str={"13","6","5"};
int a,b,c;
a = Integer.parseInt(str[0]);
System.out.print("a = "+a);