A set of beginner-friendly Java console exercises that draw simple console patterns using loops. These are study exercises from university coursework. Solutions implemented by me as part of coursework.
This repository is intended for learning and practice. Each exercise folder contains a short README with the original assignment. Read the assignment first and try to solve it yourself, then compare your approach with the provided Java solution.
What you'll practice
- Nested forloops and iteration order
- Working with row/column indices
- Diagonals in grids (i == j,i + j == n - 1)
- Parameterizing size with n
- Clean console output
- 
Sandglass — symmetric hourglass of *with spaces elsewhere.
 Solution:sandglass/Sandglass.java· README
- 
Window — rectangle with full border and a vertical bar in the center. 
 Solution:window/Window.java· README
- 
Number Square — n × ngrid of numbers that increase from edges (usesMath.min(row+1, col+1)).
 Solution:number-square/NumberSquare.java· README
- 
Labeled Pattern (code-to-output) — read the given code, predict the output; shows a labeled continueand diagonal skip.
 Solution:labeled-pattern/LabeledPattern.java· README
- 
Chessboard — prints an n × nchessboard, where each square is 2×2 characters.
 Solutions:chessboard/Chessboard1.java,chessboard/Chessboard2.java· README
Make sure you have Java installed (Java 17 or newer).
Compile and run each exercise from its folder:
# Example: Sandglass
cd sandglass
javac Sandglass.java
java Sandglass- Each folder README contains the expected output and other notes.
- Each exercise is independent and does not use Java packages, so you can compile and run it directly from its folder.