public class Command {
public static void main(String[] args) {
if (args.length > 0) {
// Loop through each command-line argument
for (int i = 0; i < args.length; i++) {
// Print each argument along with its length
System.out.println(args[i] + " " + args[i].length());
}
// Print the total number of arguments
System.out.println("Total number of arguments: " + args.length);
}
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter