How to display the second argument from command line arguments in Java

1 Answer

0 votes
// CommandLine Arguments: abcd xyz
// MyProgram abcd xyz

public class MyClass {
    public static void main(String args[]) {
      	System.out.println(args[1]);
    }
}




/*
run:
     
xyz

*/

 



answered Nov 24, 2023 by avibootz

Related questions

1 answer 165 views
1 answer 153 views
1 answer 178 views
1 answer 170 views
1 answer 172 views
...