Java Tutorial
Java Projects
Ten complete Java programs: a calculator, a student list, a library catalog, and a shopping cart.
What a project is on StudyGrid
A Java lesson shows one idea: an ArrayList, a class, a HashMap. A project puts several of them in one compiling program. Each page here walks from a small slice to a complete Java program you can run.
Click Try it in Java under an example. That opens /java/try — javac in the browser. Programs use hardcoded demo data so they run without extra stdin. After you understand the logic, wire in Scanner if you want typed input.
10 build-along projects. Each page walks through the design, then a working program you can open inTry Java at /java/try. Change a value, run it again, then try the practice tasks at the bottom.
The 10 projects
Calculator
A four-function calculator with methods per operator and a check for divide-by-zero.
methods · if · doubleBeginnerStudent Manager
Store students in an ArrayList of objects, print the roster, and find the top score.
ArrayList · class · loopIntermediateBank System
An Account class with deposit, withdraw, and a printed statement. Balance never goes negative.
class · methods · doubleBeginnerQuiz Game
A scored quiz from a list of questions. Print each prompt, check the answer, and tally.
ArrayList · class · scoreIntermediateLibrary Catalog
A catalog of books with title, author, and year. Search by author and list every match.
ArrayList · String · filterBeginnerTemperature Converter
Convert Celsius, Fahrenheit, and Kelvin with a small set of methods and formatted output.
methods · printf · doubleIntermediateTic-Tac-Toe
A 3x3 board as a 2D array of strings. Place marks, print the grid, and detect a winner.
arrays · loops · methodsIntermediateContact Book
Store contacts in a TreeMap from name to number, then add, find, and list them in order.
TreeMap · String · iterateBeginnerGrade Calculator
Convert numeric scores to letter grades, compute a GPA-style average, and print a report.
ArrayList · methods · averageIntermediateShopping Cart
A cart of line items with name, quantity, and price. Print a receipt and the grand total.
record · ArrayList · moneyHow to work a project
- Read the goal and the Java skills listed on the page.
- Compile the first small example at
/java/try. - Build up to the complete program.
- Change one value and compile again.
- Finish the practice tasks before the next project.