Home > Back-end >  JAVA small white, assigned by the teacher don't know what do you mean
JAVA small white, assigned by the teacher don't know what do you mean

Time:09-30

Public class Hello
{
Public static void main (String args [])
{
If (args. The length==0)
System. Out.println (Hello! ;
The else
for (int i=0; Iargs. Length; I++)
System. The out. Println (args [I]);
}
}
Why there are run directly, with no arguments,
Another parameters?
What does that mean?
How to run?
Can give a detailed one?

CodePudding user response:

https://www.cnblogs.com/test-angel/p/9858611.html

CodePudding user response:

The main method of the args is handed in at the command line parameters, is a string array of reference types, compiled by, for example, the command line input Java Hello, just don't run directly pass parameters, the result is the Hello! Output to the console, if the command line, enter Java Hello a b c in console the result is a b c

CodePudding user response:

That when you're running Java program can directly input string in the form of Java name followed by a space

CodePudding user response:

Simple said the main method of parameter is a String array,
Look at your teacher to write an if else statements is to let you experience the proceeding
If you don't pass parameters, the length of the array is 0, walk if branch output hello!
If there are introduced to one or more parameters, the else branch, iterate through group
  • Related