0
why java method takes String parameter and arg
public static void main(String [] arg) what happens when we take the int or float as parameters. if we take int or float as parameter ,,what are the measures need to follow
1 Réponse
+ 1
'args' is an array of type String that allow you to run your java-code with some specific parameters out of the command line. So it wouldnt help you to take e.g. an integer, because the keyboard inputs are always strings. Instead you can cast the given sting into an Integer. At this point you can also add exception handling to make sure your code behaives well when you take "g" as a parameter. Google to find out more about the functions you need for your datatype convertion - they are implemented core functions of java. :)