Examples of using the scanner, functions, and static methods
The following Java source code files provide various examples that range from okay to excellent coding principles.
All Java files can be found in the path: input_examples --> src --> edu --> lewisu --> input_examples/
-
ExampleInput.java -- This is your basic Java prompting and input demonstration.
-
ExampleInputWithFunctions -- This performs the same work as above, but the code is broken up into functions. Further, these functions do more work with respect to error- and range-checking.
-
Main.java and Utils.java -- This is an example of moving much of the code into static methods in a separate class. We retain the functionality from above, but add new features via overloaded methods.