Java Command Line Arguments Primer Tutorial

Java Command Line Arguments Primer Tutorial

Java Command Line Arguments Primer Tutorial

If you are writing a batch process and have reached a process part requiring a compiled program (perhaps because this part has some CPU grunt associated with it) you can do a lot worse than use Java and allow user usage flexibility via that Java application’s command line argument usage logic, to write that part of the overall solution (which is, perhaps, some “brilliant-issimo” shell script … know you can do it). Think of Command Line Arguments as a Java (or C or C++) program’s interface to the operating system. Think of it like those brilliant Linux and Unix commands with all those switches, which do very well piped off each other, as ingredients in making the “cake”. The cake metaphor is pretty good for thinking of the whole solution made up of various parts (Visual Studio thinks of its applications as “solutions” also).

If you want your Java program to be like a pipe program, have it use standard input and standard output. Java and C(++) have lots of similarities in this area. So, today, with our tutorial we ask for some numeric input and calculate the mean, median, mode and standard deviation of that set of numbers, allowing for various modes in input user usage.

Link to Java programming source code which you should rename to CommandLineLogic.java

If this was interesting you may be interested in this too.

This entry was posted in eLearning, Operating System, Tutorials and tagged , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>