0
what is a=integer.parselnt(args[0])?
can anyone explain this
4 Answers
+ 1
args are for command-line arguments.
suppose you create a program called isEqual that needs two commad line arguments.
if you run isEqual program and supply two parameters as below:
java isEqual 5 9
Then
args [0] 》 5
args [1] 》 9
As args are String and as the first paramer is an integer you need to convert from String to int
int a=integer.parselnt(args[0]);
Here:
args [0] 》 "5"
a 》5
0
Integer.parseInt("string") will convert string argument to number, If given string is not number it will throw exception. Generally java read command line argument in the form of strings so to do any integer manipulations we need to convert atring type to integer type.Hope this helps.
0
above is all right...
0
thanks for all
Hot today
I have made a calculator in which my % (Percentage) not work correctly for 100%50 or 100%20.
1 Votes
Тренажер кода
0 Votes
Python palindrome challenge.
1 Votes
Java
0 Votes