Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+25 votes

In the "public static void main (String [] args) {" line, what does the word args do and why is it necessary?

asked in CSC211_Winter2018 by (1 point)

3 Answers

+14 votes

As I understand, args stands for "arguments" in Java. and "String [] args" simply relates to an array of string arguments/statements that you pass to your application when you run it.

Hope this helps.

answered by (1 point)
+10 votes

Later on, it turns out that it is possible to run a computer program while also handing some input data to that program at the same time.

These args (short for "command line arguments") represent the input data. For example, if you wanted to launch a web browser and have it open up a certain website, the web browser program would accept the website's URL as an "argument", so it would know which website to display immediately upon launch.

Note: You will not need to know how these args work in order to complete any of the work for CSC 211. It's a more advanced feature. Of course, you're welcome to learn more about it if you're curious!

answered by (3.5k points)
+7 votes

I believe it stands for Argument

answered by (-499 points)
...