+ 6
Integer.parseInt(input1, n) can you please tell me what this function do?
Java programing code
6 Answers
+ 4
Integer.parseInt(String s, int radix)
where s â is a String containing the integer representation to be parsed.
radix â This is the radix to be used while parsing s.
This method returns the integer represented by the string argument in the specified radix.
e.g. a=Integer.parseInt("1110",2);
System.out.println(a);
// outputs a=14
+ 8
int n=Integer.parseInt ("1234");
System.out.print(n==1234);
//I use this
+ 4
not that
+ 3
input,n meaning
+ 2
parseInt() is used to convert string to Integer
0
I don't have any idea about that "input1, n" part. But in general, Integer.parseInt() function is used in Java to convert a String data into an integer one (kind of like how Integer.valueOf() works). Integer.parseInt() is also used in Java io package (buffer reader class) to take integer inputs although that's a tedious process and not really used now a days.