🔺Java Patterns Programs
40 practical Java programs for learning patterns.
🔍
Beginner
01
View Program →Print Binary Triangle
Prints a triangle where every number in a row is that row's own parity bit.
beginnerNumber Patterns
02
View Program →Print Character Triangle
Prints a left-aligned triangle built from consecutive alphabet letters instead of stars.
beginnerCharacter Patterns
03
View Program →Print Continuous Number Pattern
Fills a fixed-size grid with consecutive numbers that keep counting up across every row.
beginnerNumber Patterns
04
View Program →Print Floyd's Triangle
Prints a triangle of consecutive numbers that never resets between rows.
beginnerNumber Patterns
05
View Program →Print Inverted Number Triangle
Prints a left-aligned triangle whose row width shrinks, while each row still counts up from 1.
beginnerNumber Patterns
06
View Program →Print Inverted Right Triangle
Prints a left-aligned triangle of stars that shrinks by one star per row.
beginnerStar Patterns
07
View Program →Print Inverted Triangle
Prints a left-aligned shrinking star triangle by building each row as one string, without a separate inner loop.
beginnerStar Patterns
08
View Program →Print Left-Aligned Triangle
Prints a left-aligned growing star triangle by building each row as one string, without a separate inner loop.
beginnerStar Patterns
09
View Program →Print Number Triangle
Prints a left-aligned triangle where each row counts up from 1.
beginnerNumber Patterns
10
View Program →Print Rectangle Star Pattern
Prints a solid grid of stars with a separate row count and column count.
beginnerStar Patterns
11
View Program →Print Repeated Number Pattern
Prints a left-aligned triangle where each row repeats its own row number that many times.
beginnerNumber Patterns
12
View Program →Print Right Triangle
Prints a left-aligned triangle of stars that grows by one star per row.
beginnerStar Patterns
13
View Program →Print Square Star Pattern
Prints a solid square grid of stars, n rows by n columns.
beginnerStar Patterns
14
View Program →Print 0-1 Triangle
Prints a triangle where each position alternates between 0 and 1 in a checkerboard pattern.
beginnerNumber Patterns
Intermediate
15
View Program →Print Alphabet Diamond
Prints a diamond built from repeating letters by joining a pyramid to its own mirror image.
intermediateCharacter Patterns
16
View Program →Print Alphabet Pyramid
Prints a centered pyramid where every row is filled with a single repeating letter.
intermediateCharacter Patterns
17
View Program →Print Diamond Number Pattern
Prints a diamond shape built from repeated row numbers instead of stars.
intermediateNumber Patterns
18
View Program →Print Diamond Pattern
Prints a diamond of stars by stacking a pyramid on top of an inverted pyramid.
intermediateStar Patterns
19
View Program →Print Hollow Diamond
Prints a diamond outline made of stars, hollow all the way through.
intermediateStar Patterns
20
View Program →Print Hollow Pyramid
Prints a centered pyramid outline, hollow except for a solid base.
intermediateStar Patterns
21
View Program →Print Hollow Rectangle
Prints a rectangle outline made of stars, hollow on the inside.
intermediateStar Patterns
22
View Program →Print Hollow Rhombus
Prints the outline of a slanted parallelogram, leaving its interior empty.
intermediateStar Patterns
23
View Program →Print Hollow Square
Prints a square outline of stars, hollow on the inside.
intermediateStar Patterns
24
View Program →Print Hollow Triangle
Prints a left-aligned triangle outline, hollow except for a solid base.
intermediateStar Patterns
25
View Program →Print Hourglass Pattern
Prints a wide-narrow-wide star shape by joining an inverted triangle to a regular one.
intermediateStar Patterns
26
View Program →Print Inverted Alphabet Pyramid
Prints a centered pyramid of repeating letters upside down, widest row first.
intermediateCharacter Patterns
27
View Program →Print Inverted Number Pyramid
Prints a centered pyramid of repeated row numbers, upside down with its apex at the bottom.
intermediateNumber Patterns
28
View Program →Print Inverted Pyramid
Prints a centered pyramid of stars turned upside down, apex at the bottom.
intermediateStar Patterns
29
View Program →Print Multiplication Triangle
Prints a growing triangle where each row shows that row number's own multiplication table.
intermediateNumber Patterns
30
View Program →Print Number Pyramid
Prints a centered pyramid where every row is filled with that row's own number.
intermediateNumber Patterns
31
View Program →Print Pascal's Triangle Pattern
Prints Pascal's triangle centered, so its outline reads as an actual triangle shape.
intermediateNumber Patterns
32
View Program →Print Plus Pattern
Prints stars forming a plus sign across a square grid, using the middle row and column.
intermediateStar Patterns
33
View Program →Print Pyramid Pattern
Prints a centered pyramid of stars, apex at the top.
intermediateStar Patterns
34
View Program →Print Rhombus Pattern
Prints a slanted parallelogram of stars using increasing indentation per row.
intermediateStar Patterns
35
View Program →Print X Pattern
Prints stars forming the letter X across a square grid, using both diagonals.
intermediateStar Patterns
Advanced
36
View Program →Print Butterfly Pattern
Prints a butterfly-shaped star pattern using two mirrored triangular wings.
advancedStar Patterns
37
View Program →Print Concentric Number Pattern
Fills an n x n grid so each concentric ring of cells shares the same number.
advancedNumber Patterns
38
View Program →Print Spiral Number Pattern
Fills an n x n grid with numbers 1 through n squared in clockwise spiral order.
advancedNumber Patterns
39
View Program →Print Wave Pattern
Prints a wavy line of stars that rises to a peak and dips to a trough as it crosses the columns.
advancedStar Patterns
40
View Program →Print Zig-Zag Pattern
Prints a three-row zigzag line of stars that travels up and down across the columns.
advancedStar Patterns