tuturyokgaming tuturyokgaming - 1 year ago 198
Java Question

Java command line parameters

I'm just wondering how to do Java command-line with parameters? For example :

javac Test.java


java Test 3 5

then after running the command line

expected output:

3 5

public class Test{

public static void main(String[] args){

int num1 = 1;
int num2 = 2;



Answer Source

I think you can use args as input parameters.

public static void main(String[] args){
    System.out.println(args[0] + " " + args[1]);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download