+ 6

Integer.parseInt(input1, n) can you please tell me what this function do?

Java programing code

14th Mar 2018, 1:14 PM
Tushit Maheshwari
Tushit Maheshwari - avatar
6 ответов
+ 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
14th Mar 2018, 1:32 PM
Manorama
Manorama - avatar
+ 8
int n=Integer.parseInt ("1234"); System.out.print(n==1234); //I use this
14th Mar 2018, 1:21 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 4
not that
14th Mar 2018, 1:18 PM
Tushit Maheshwari
Tushit Maheshwari - avatar
+ 3
input,n meaning
14th Mar 2018, 1:19 PM
Tushit Maheshwari
Tushit Maheshwari - avatar
+ 2
parseInt() is used to convert string to Integer
14th Mar 2018, 1:17 PM
Manorama
Manorama - avatar
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.
4th Jul 2018, 5:44 PM
Harsh Agarwal
Harsh Agarwal - avatar