Skip to content

MrCoder240/Java_pattern_series

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Java Pattern Series

Ask DeepWiki

This repository contains a collection of Java programs designed to print various star (*) patterns to the console. These exercises are excellent for practicing and understanding fundamental programming concepts like nested loops, conditional logic, and user input handling in Java.

Included Patterns

This collection features a wide variety of patterns, from simple geometric shapes to more complex artistic designs. All pattern programs are located within the Star Patterns/ directory.

Geometric Shapes

  • Square & Hollow Square
  • Hollow Rectangle
  • Right Triangle & Inverted Right Triangle
  • Mirrored Right Triangle & Inverted Mirrored Right Triangle
  • Pyramid & Hollow Pyramid
  • Inverted Pyramid & Hollow Inverted Pyramid
  • Diamond & Hollow Diamond
  • Hourglass
  • Cross & Plus Sign

Symmetrical & Artistic Patterns

  • Butterfly & Hollow Butterfly
  • Heart
  • Christmas Tree
  • Right Pascal's Triangle & Left Pascal's Triangle
  • Double Hill
  • Diamond In a Box
  • Spiral
  • Wave
  • ZigZag

Alphanumeric Patterns

  • Letter A
  • Letter Z

How to Compile and Run

Each pattern is a standalone Java program. It prompts the user for a size parameter (like the number of rows) and then generates the corresponding pattern.

  1. Clone the Repository

    git clone https://github.com/MrCoder240/java_pattern_series.git
    cd java_pattern_series
  2. Navigate to the Directory All the source files are in the Star Patterns directory.

    cd "Star Patterns"
  3. Compile a Pattern Use the Java compiler (javac) to compile the .java file of the pattern you want to see. For example, to compile the Pyramid.java file:

    javac Pyramid.java
  4. Run the Program Use the java command to execute the compiled class. The program will then prompt you for input.

    java Pyramid

    Example Interaction:

    Enter the number of rows: 5
        *
       ***
      *****
     *******
    *********
    

You can repeat the compile and run steps for any other pattern file in the directory.

About

All type of pattterns diagram code are avialable here

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages