A structured collection of Java programs covering fundamental programming concepts. Each example is designed to demonstrate core Java features through practical, runnable code.
- HelloWorld - Basic output and program structure
- Variables - Variable declaration and data types
- UserInput - Reading input with Scanner
- Math - Mathematical operations and calculations
- Casting - Type conversion and casting
- FormattedOutput - String formatting and output
- Conditionals - If-else statements and decision making
- Loops - For, while, and do-while loops
- Nested - Nested loop patterns
- Methods - Function definition and calling
- Arrays - Array creation, manipulation, and iteration
- Dimensions - Multi-dimensional arrays
- Grid - Working with 2D arrays and grids
- Nums - Practice problems and exercises
- Workouts - Workout tracking application
- Java Development Kit (JDK) 8 or higher
- Make (for using the Makefile)
Each example can be run using the provided Makefile commands:
# Introduction examples
make hello # Hello World program
make variables # Variable examples
make input # User input example
make calc # Math operations
make cast # Type casting
make format # Formatted output
# Conditionals
make condition # If-else statements
# Loops
make loops # Loop examples
make nested # Nested loops
# Methods
make methods # Method examples
# Arrays
make arrays # Array examples
make ds # Multi-dimensional arrays
make grid # 2D array grids
# Problems
make nums # Practice problems
# Projects
make project # Workout tracking appRemove all compiled .class files:
make cleanRecommended order for beginners:
- Start with
introduction/- Learn the basics - Move to
conditionals/- Understand decision making - Practice
loops/- Master iteration - Explore
methods/- Write reusable code - Work with
arrays/- Handle collections of data - Try
problems/- Apply what you've learned - Build
projects/- Create complete applications
- Create a new
.javafile in the appropriate directory - Add a corresponding Makefile target
- Follow the package naming convention (package name = directory name)
- Each file is self-contained with a
mainmethod - Packages match directory names
- Clear, educational code with minimal complexity
- Interactive examples use
Scannerfor input