+ 1

what is [] in public static void main(String [] args)?

java question

4th Jan 2017, 3:39 PM
Jestoni Zamora Macasohol
Jestoni Zamora Macasohol - avatar
8 Antworten
+ 10
Creates an "args" String and makes it an Array.
4th Jan 2017, 3:41 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 9
Me neither ~_~ (yet)
4th Jan 2017, 3:45 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 4
Java only starts running a program with the specific public static void main(String[] args) signature, and one can think of a signature like their own name - it's how Java can tell the difference between someone else's main() and the one true main(). String[] args is a collection of Strings, separated by a space, which can be typed into the program on the terminal. More times than not, the beginner isn't going to use this variable, but it's always there just in case.
4th Jan 2017, 3:52 PM
Alikhan Suleimen
Alikhan Suleimen - avatar
+ 3
why it is in the main method then? i dont get it
4th Jan 2017, 3:45 PM
Jestoni Zamora Macasohol
Jestoni Zamora Macasohol - avatar
+ 3
then can it be modified as ( int[] args)?
4th Jan 2017, 4:00 PM
Jestoni Zamora Macasohol
Jestoni Zamora Macasohol - avatar
+ 3
Nope It's tell that no main method you must use that for sure
4th Jan 2017, 4:33 PM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
+ 3
java is very broad....ty for answer
4th Jan 2017, 11:43 PM
Jestoni Zamora Macasohol
Jestoni Zamora Macasohol - avatar