How to pass arguments | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to pass arguments

System.out.println("users:"+args【0】+","+args【1】); we have to pass arguments ?

10th Feb 2019, 6:46 AM
Yash Bafna
Yash Bafna - avatar
1 Answer
+ 7
If you've compiled your .java files to .class using javac, you can then execute them on the command line using the java cmd. java myClass argument1 argument2 etc check: https://docs.oracle.com/javase/tutorial/essential/environment/cmdLineArgs.html
10th Feb 2019, 6:54 AM
Hatsy Rei
Hatsy Rei - avatar