answersLogoWhite

0

By using command line arguments we can pass values to the static void main method at the time of running the Java class.

For example:

if Class name is A,then to run this class and accepts command line then run this by using below line

java A <argument1> <argument2> ....

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

What is static void Main?

The String array args refers to the arguments that the program may require before starting. In many cases you may want the program to take some values as input for processing. this string array is for that purpose.


How do you pass the parameter in applet?

If you have the function main()... You can use its arguments to pass information.


What is the main difference between static and dynamic pass box?

Static pass through boxes are used to transfer materials between two clean rooms that are equally clean. Dynamic pass through boxes are used to transfer materials from uncontrolled environment to a controlled environment.


Why in java string args is passed in main method?

The String[] args parameter is an array of Strings passed as parameters when you are running your application through command line in the OS. The java -jar command will pass your Strings update and notify to your public static void main() method. To learn more about data science please visit- Learnbay.co


Where is the Eagle Pass Public Library in Eagle Pass located?

The address of the Eagle Public Library is: 2Nd &amp; Amundsen, Eagle, 99738 0045


Write a java program to pass a string have a good day from command line?

public class HaveAGoodDay { public static void main(String[] args) { for (final String arg : args){ System.out.print(arg +" "); } } } compile and run the program: java HaveAGoodDay have a good day. output: have a good day.


Write a program in java show how different string Class construcotrs are used to create string objects?

public class Test { public static void main(String[] args){ String str = new String("Rocky"); String str1 = "Rocky"; StringBuffer sb = new StringBuffer(); sb.append("Rocky"); String str2 = new String(sb); } } Above are three commonly used ways of creating Strings. Apart from you you can also pass byte arrays and character arrays as arguments to the String constructor


Can static electricity pass through wires?

Yes, static electricity can pass through wires by creating a flow of electrons. However, the ability of static electricity to pass through wires depends on the voltage and conductivity of the wire.


Why you cant pass the address of static variable?

You must have made an error, it should work perfectly. Example:int main (void){static int foobar;printf ("Address of foobar is %p\n", &foobar);return 0;}


How do you pass command line arguments using turbo in c compiler?

In the Options menu the Arguments command.


Define method overloading and write two method headers that together exhibit overloading?

Method overloading is when two or more methods have the same name, but the computer can differentiate between the methods by looking at the parameters. Example: public static void go(int x) public static void go(double x) If you pass an int, the first method would be called. If you pass a double, the second method would be called


What is the argument of main()method?

In Java, the main() method is typically written something like this:public static void main(String [ ] args)The argument is what is in parentheses, in this case: "String [] args". I believe this can also be written as "String args[]". It refers to parameters received by the Java program from the command line. That is, the user can write, for example:java MyClass info1 info2In this example, "info1" and "info2" will be received by the main method, in the args[] array.