Java ProgramsPatterns

🔺Java Patterns Programs

40 practical Java programs for learning patterns.

🔍
Beginner
01
Print Binary Triangle
Prints a triangle where every number in a row is that row's own parity bit.
beginnerNumber Patterns
View Program →
02
Print Character Triangle
Prints a left-aligned triangle built from consecutive alphabet letters instead of stars.
beginnerCharacter Patterns
View Program →
03
Print Continuous Number Pattern
Fills a fixed-size grid with consecutive numbers that keep counting up across every row.
beginnerNumber Patterns
View Program →
04
Print Floyd's Triangle
Prints a triangle of consecutive numbers that never resets between rows.
beginnerNumber Patterns
View Program →
05
Print Inverted Number Triangle
Prints a left-aligned triangle whose row width shrinks, while each row still counts up from 1.
beginnerNumber Patterns
View Program →
06
Print Inverted Right Triangle
Prints a left-aligned triangle of stars that shrinks by one star per row.
beginnerStar Patterns
View Program →
07
Print Inverted Triangle
Prints a left-aligned shrinking star triangle by building each row as one string, without a separate inner loop.
beginnerStar Patterns
View Program →
08
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
View Program →
09
Print Number Triangle
Prints a left-aligned triangle where each row counts up from 1.
beginnerNumber Patterns
View Program →
10
Print Rectangle Star Pattern
Prints a solid grid of stars with a separate row count and column count.
beginnerStar Patterns
View Program →
11
Print Repeated Number Pattern
Prints a left-aligned triangle where each row repeats its own row number that many times.
beginnerNumber Patterns
View Program →
12
Print Right Triangle
Prints a left-aligned triangle of stars that grows by one star per row.
beginnerStar Patterns
View Program →
13
Print Square Star Pattern
Prints a solid square grid of stars, n rows by n columns.
beginnerStar Patterns
View Program →
14
Print 0-1 Triangle
Prints a triangle where each position alternates between 0 and 1 in a checkerboard pattern.
beginnerNumber Patterns
View Program →
Intermediate
15
Print Alphabet Diamond
Prints a diamond built from repeating letters by joining a pyramid to its own mirror image.
intermediateCharacter Patterns
View Program →
16
Print Alphabet Pyramid
Prints a centered pyramid where every row is filled with a single repeating letter.
intermediateCharacter Patterns
View Program →
17
Print Diamond Number Pattern
Prints a diamond shape built from repeated row numbers instead of stars.
intermediateNumber Patterns
View Program →
18
Print Diamond Pattern
Prints a diamond of stars by stacking a pyramid on top of an inverted pyramid.
intermediateStar Patterns
View Program →
19
Print Hollow Diamond
Prints a diamond outline made of stars, hollow all the way through.
intermediateStar Patterns
View Program →
20
Print Hollow Pyramid
Prints a centered pyramid outline, hollow except for a solid base.
intermediateStar Patterns
View Program →
21
Print Hollow Rectangle
Prints a rectangle outline made of stars, hollow on the inside.
intermediateStar Patterns
View Program →
22
Print Hollow Rhombus
Prints the outline of a slanted parallelogram, leaving its interior empty.
intermediateStar Patterns
View Program →
23
Print Hollow Square
Prints a square outline of stars, hollow on the inside.
intermediateStar Patterns
View Program →
24
Print Hollow Triangle
Prints a left-aligned triangle outline, hollow except for a solid base.
intermediateStar Patterns
View Program →
25
Print Hourglass Pattern
Prints a wide-narrow-wide star shape by joining an inverted triangle to a regular one.
intermediateStar Patterns
View Program →
26
Print Inverted Alphabet Pyramid
Prints a centered pyramid of repeating letters upside down, widest row first.
intermediateCharacter Patterns
View Program →
27
Print Inverted Number Pyramid
Prints a centered pyramid of repeated row numbers, upside down with its apex at the bottom.
intermediateNumber Patterns
View Program →
28
Print Inverted Pyramid
Prints a centered pyramid of stars turned upside down, apex at the bottom.
intermediateStar Patterns
View Program →
29
Print Multiplication Triangle
Prints a growing triangle where each row shows that row number's own multiplication table.
intermediateNumber Patterns
View Program →
30
Print Number Pyramid
Prints a centered pyramid where every row is filled with that row's own number.
intermediateNumber Patterns
View Program →
31
Print Pascal's Triangle Pattern
Prints Pascal's triangle centered, so its outline reads as an actual triangle shape.
intermediateNumber Patterns
View Program →
32
Print Plus Pattern
Prints stars forming a plus sign across a square grid, using the middle row and column.
intermediateStar Patterns
View Program →
33
Print Pyramid Pattern
Prints a centered pyramid of stars, apex at the top.
intermediateStar Patterns
View Program →
34
Print Rhombus Pattern
Prints a slanted parallelogram of stars using increasing indentation per row.
intermediateStar Patterns
View Program →
35
Print X Pattern
Prints stars forming the letter X across a square grid, using both diagonals.
intermediateStar Patterns
View Program →