Other contributors have said "Mini projects in java?" is the same question as "What are some ideas for mini projects in Java?" If you believe that these are not asking the same thing and should be answered differently, click here

What are some ideas for mini projects in Java?

Answer:
Depends on what you want the project to teach.

Hello, world!

What project list would be complete without the standard Hello World project? Learn the creation of classes, use of the main method, and standard output.


Syntax/concept familiarity

Projects which deal with calculating mathematical concepts are common. Factorials, GCD, LCM, area of geometric shapes, etc. Also, simple string manipulation projects, like printing out a string of a firstname-lastname pair, then switching them. Use arrays or other data structures to process many of these calculations and store the answers.

Command line arguments

As above, except have the functions calculated by input given through the command line by the user.

Specific example: Have the user enter any number of integers as command line arguments to have their factorials calculated. If one of the inputs is not an integer, print an error message. If one of the inputs would result in a factorial that would be too large (greater than 20 for a long integer), print an error message. Otherwise print the factorial of the number.

Other points of this exercise are to validate input and (possibly) use a recursive solution for a problem.

Standard input

As above, except take input via standard input.


Specific example: Have the user enter numbers (either integer or floating point). Keep track of all unique numbers entered until the user enters non-numeric data. Once done accepting input: print all numbers in order from least to greatest, print the sum/mean/median/mode of the numbers, and print how many numbers entered were integers and how many were floating point.

Other points of this exercise are to consider various types of data structures, sorting data, parsing data, and filtering data.

File I/O

As above, except take input from files and direct output into files.


Specific example: Have the user specify two file names on the command line. The first will be our input file, the second will be our output file. The program should exit with an error message if: there are an incorrect number of command line arguments, both are the same file name, or either specifies a file that does not exist. Otherwise, the first file will contain a series of lines of text. Each line will have three parts, separated by a space character. Each line will contain one part containing entirely numbers, one part containing entirely lowercase letters, and one part containing entirely uppercase letters. The parts of each line will be in a different order. The program will parse each line and write them to output in the following format: "(number part,lowercase part,uppercase part)".

Other points of this exercise are to learn exception handling (must-have with file I/O), data type recognition, and output formatting.

GUI

As above, except make it look pretty.

Specific example: Have the user enter three values into a text box, then press a button. The program will interpret the three values as the length, width, and height of a cuboid (3D rectangle). The button will cause another window to pop up and display information about the cuboid: volume, surface area of each of the three distinct sides, total surface area, and distance from one corner to the opposite corner. Finally, (and most importantly?) ensure that the program exits when the user closes the window.

For extra difficulty, implement the following: Do not allow the three input boxes to record any non-numeric characters. Make the popup window block input to the original window until it is closed. Use a layout which will ensure that the input window will both allow for resizing and space out the components evenly whenever the window size changes.

Other points of this exercise are sub-concepts of GUI building: component layout, event handling, and "graceful" exits from a program.

Networking

As above, except read and write input between networked computers.


Specific example: This will require two different programs running on remote machines. Have the user enter a string in the date format: "MM/DD/YYYY". Ensure that the date is in the past. Continue asking for input until a valid date is entered. The program should then connect to a remote computer and send the date string over. At this point, the program running on the remote computer will analyze the string and determine what day of the week that date was. The remote program will then take today's date and figure out when the next day (tomorrow or later) will be that will be the same day of the week. It will send this back to the original program. The original program will print this value out and both programs will exit.

Reflection

By "reflection" I mean having to do with a program knowing information about itself. Have the program read information from itself or even have it modify some of its methods and execute itself.


Specific example: Have the user input the name of a class. The program should display information about each method in the class in the format: "access_modifier return_type method_name(parameters) [throws exception_types]"

Another (harder) specific example: Have the user input any valid code, a single line at a time. When the user specifies, execute the code and display the results (if any).



If you didn't figure it out already, just take the simple calculations from the first section and incorporate them into any new concept you want to teach.

Note: There are comments associated with this question. See the discussion page to add to the conversation.
First answer by ID2006989828. Last edit by Moobler. Contributor trust: 354 [recommend contributor recommended]. Question popularity: 13 [recommend question].