I got confused with how to use args.length
, I have coded something here:
public static void main(String[] args) {
int[] a = new int[args.length];
for (int i = 0; i < args.length; i++) {
System.out.print(a[i]);
}
}
The printout is 0
no matter what value I put in command line arguments, I think I probably confused args.length
with the args[0]
, could someone explain? Thank you.