zsocc zsocc - 5 months ago 6x
Java Question

Java command line set argument with "="

I have a method:

public String sample (String A, int B, int C){
String fin = "";
return fin;

I want to run it in command line like this:
d:>java -jar prac.jar B=5

How can I set parameter in command line with "="?


In your main method, you deal with parameters that are passed:

public static void main(String[] args) {
    // args[0] = parameter 1;
    // args[1] = parameter 2;
    // args[n] = parameter n+1;
    sample(args[0], Integer.parseInt(args[1]), Integer.parseInt(args[2]));