+ 1
Class in Java
what is the functionality of the following words? "String[ ] args" in the declaration of the class
1 ответ
+ 3
String[] args in main method means that it can accept an array of string parameter. You would be able to use this when you compile and execute your code from terminal or command line. You can give command line arguments and can later use them in the code.
For example if you have a class name Program.
To compile: javac Program.java
To run: java Program
You can also say: java Program Ariana
System.out.print(args [0]);
The above line inside main method will print your name.