Hi!
I'm beginning AP Computer Science at my school and we're doing Java.
I've run into some things that I would like to ask:
1. 'public static void main (String[] args)' In the '(String[] args)' part, will there ever be anything else that can be there? I searched and all of the tutorials I've read have (String[] args), nothing else. What is the purpose of that whole part? What does the 'args' mean?
What I think it means is that after typing 'java foo <inputs>', that the inputs will be assigned to args[0] and [1] and so on. Does that mean that I can have an unlimited number of inputs? If I type 'java foo' with 100 inputs, will it automatically create 'args[0]' to 'args[99]'?
What will happen if I type '(String[3] args)'? Or if I change 'args' to 'nums'? Will it make all the arguments 'nums[0]' and so on?
And the fact that it's 'String[]' means that the inputs will be strings?
Thanks a lot!
I'm beginning AP Computer Science at my school and we're doing Java.
I've run into some things that I would like to ask:
1. 'public static void main (String[] args)' In the '(String[] args)' part, will there ever be anything else that can be there? I searched and all of the tutorials I've read have (String[] args), nothing else. What is the purpose of that whole part? What does the 'args' mean?
What I think it means is that after typing 'java foo <inputs>', that the inputs will be assigned to args[0] and [1] and so on. Does that mean that I can have an unlimited number of inputs? If I type 'java foo' with 100 inputs, will it automatically create 'args[0]' to 'args[99]'?
What will happen if I type '(String[3] args)'? Or if I change 'args' to 'nums'? Will it make all the arguments 'nums[0]' and so on?
And the fact that it's 'String[]' means that the inputs will be strings?
Thanks a lot!