Skip to content

Alpha2820/Pattern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Java Pattern Printing Collection

This repository contains a set of simple Java programs that demonstrate how to print various patterns using loops and basic logic. The code is grouped into three categories: character patterns, number patterns, and star patterns.

πŸ“ Directory Structure

  • Character Patterns/

    • Programs that print patterns using letters (A, B, C, ...).
    • Example: pattern1.java prints a triangle of increasing alphabets.
  • Number Patterns/

    • Programs using digits (1, 2, 3, ...).
    • Each file corresponds to a different pattern (triangles, pyramids, matrices, etc.).
  • Star Patterns/

    • Patterns made with the asterisk (*) character.
    • Common exercises include pyramids, diamond shapes, and right/left aligned triangles.

Each folder contains 12 example programs named pattern1.java through pattern12.java.

πŸš€ Usage

  1. Open any pattern file in your favorite Java IDE or a text editor.
  2. Compile using javac:
    javac pattern1.java
  3. Run the compiled class and provide an integer input (rows/size) when prompted:
    java pattern1
  4. Observe the printed pattern in the console.

All programs read a single integer from standard input which controls the size of the pattern.

πŸ“ Adding New Patterns

  • Copy one of the existing files and update the logic to create a new pattern.
  • Maintain the same input strategy (read an integer from Scanner).
  • Use descriptive comments at the top to indicate what the pattern looks like.

πŸ“š Learning Goals

These examples are ideal for beginners learning how to use:

  • for loops (nested loops)
  • Scanner for input
  • Basic control flow and character/number arithmetic
  • Console output formatting with System.out.print and println

Feel free to explore, modify, and extend these programs as you learn Java!


Created on Feb 20, 2026

About

Collection of beginner Java programs that print character, number and star patterns.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages