How do I print out a set of integers from my args
variable in Java?
I tried:
System.out.println("The numbers are " + args.length);
But all that does is print out the number of elements in the array.
I want it so that if there are 5 arguments passed: 1 2 3 4 5
the output should be:
1, 2, 3, 4, 5
Take a look if you like
System.out.println("The numbers are "+Arrays.toString(args));
If not, you'll have to loop over the array and format it yourself.