A curated collection of 25+ Java Pattern Printing Programs covering star, number, hollow, pyramid, butterfly, Pascal's Triangle, X, K, mirror image, diamond, and many other classic patterns.
Designed for students and beginners to strengthen nested loops, conditional statements, logical thinking, and problem-solving through hands-on Java programming.
Java • Pattern Printing • Java Programming • DSA • Nested Loops • Logic Building • Problem Solving • Star Patterns • Number Patterns • Hollow Patterns • Pyramid Patterns • Butterfly Pattern • Pascal's Triangle • College Lab Programs • Coding Interview Preparation • Beginner Friendly
- 📌 About
- ✨ Features
- 📂 Repository Structure
- 📖 Patterns Included
- 🖼️ Pattern Gallery
- 🚀 Getting Started
- 💡 Concepts Covered
- 🛠️ Technologies Used
- 🤝 Contributing
- ⭐ Support
Pattern printing is one of the most effective ways to develop programming logic. It helps build a strong understanding of nested loops, conditional statements, iteration, and console output formatting, making it an essential topic for every Java beginner.
This repository provides a carefully organized collection of 25+ Java Pattern Printing Programs, where each pattern is stored in its own folder along with its corresponding output screenshot.
The programs are written in pure Java, making them easy to understand, practice, and modify. Whether you're learning Java for the first time or revising concepts before coding interviews, this repository serves as a practical reference.
This repository is ideal for:
- 🎓 College Practicals & Lab Exams
- 💻 Java Programming Practice
- 📚 DSA Fundamentals
- 🧠 Logic Building
- 💼 Technical Interview Preparation
- ⭐ 25+ Java Pattern Printing Programs
- 📂 Clean and organized folder structure
- 📷 Output screenshot for every program
- 💻 Pure Java implementation (No external libraries)
- 🧠 Beginner-friendly source code
- 📚 Suitable for college lab practicals
- 🚀 Great for improving nested loop logic
- 🎯 Excellent practice for DSA beginners
- 🔄 Covers star, number, hollow, pyramid, butterfly, diamond, Pascal's Triangle, X, K, mirror image, and many more patterns
- 📖 Easy to understand and modify
pattern_printing
│
├── butterfly_pattern
├── diamond_pattern
├── hollow_diamond_pyramid
├── hollow_hourglass
├── hollow_triangle_pattern
├── k_pattern
├── left_triangle_pattern
├── mirror_image_pattern
├── number_changing_pattern
├── number_increasing_pyramid
├── number_increasing_reverse_pyramid
├── number_triangle_pattern
├── parallelogram_pattern
├── pattern_1
├── reverse_diamond_pattern
├── reverse_hollow_triangle
├── reverse_left_half_pyramid
├── reverse_number_triangle_pattern
├── reverse_right_half_pyramid
├── right_half_pyramid
├── right_pascals_triangle
├── square_hollow
├── triangle_pattern
├── x_pattern
├── zero_one_pattern
│
├── screenshots
│ ├── butterfly_pattern.png
│ ├── diamond_pattern.png
│ ├── hollow_diamond_pyramid.png
│ ├── ...
│ └── zero_one_pattern.png
│
├── README.md
└── .gitignore
| Feature | Details |
|---|---|
| 💻 Language | Java |
| 📂 Programs | 25+ |
| 📷 Screenshots | Included |
| 📚 Difficulty | Beginner → Intermediate |
| 🎯 Purpose | Logic Building & Nested Loop Practice |
| 🛠 IDE | VS Code / IntelliJ IDEA / Eclipse |
| 📜 License | MIT |
| ⭐ Repository Type | Educational |
The repository contains a diverse collection of Java pattern printing programs that cover fundamental to intermediate-level pattern problems.
| No. | Pattern | Category |
|---|---|---|
| 1 | Pattern 1 | Basic |
| 2 | Triangle Pattern | Star Pattern |
| 3 | Hollow Triangle Pattern | Hollow Pattern |
| 4 | Left Triangle Pattern | Star Pattern |
| 5 | Right Half Pyramid | Pyramid |
| 6 | Reverse Right Half Pyramid | Pyramid |
| 7 | Reverse Left Half Pyramid | Pyramid |
| 8 | Number Triangle Pattern | Number Pattern |
| 9 | Reverse Number Triangle Pattern | Number Pattern |
| 10 | Number Increasing Pyramid | Number Pattern |
| 11 | Number Increasing Reverse Pyramid | Number Pattern |
| 12 | Number Changing Pattern | Number Pattern |
| 13 | Square Hollow | Hollow Pattern |
| 14 | Diamond Pattern | Star Pattern |
| 15 | Hollow Diamond Pyramid | Hollow Pattern |
| 16 | Reverse Diamond Pattern | Star Pattern |
| 17 | Butterfly Pattern | Symmetric Pattern |
| 18 | Mirror Image Pattern | Symmetric Pattern |
| 19 | Hollow Hourglass | Hollow Pattern |
| 20 | K Pattern | Alphabet Pattern |
| 21 | X Pattern | Alphabet Pattern |
| 22 | Zero-One Pattern | Number Pattern |
| 23 | Parallelogram Pattern | Geometric Pattern |
| 24 | Right Pascal's Triangle | Pascal Pattern |
| 25 | Reverse Hollow Triangle | Hollow Pattern |
Every program includes an output screenshot to help visualize the expected result.
| Butterfly Pattern | Diamond Pattern |
|---|---|
![]() |
![]() |
| Hollow Diamond Pyramid | Hollow Hourglass |
|---|---|
![]() |
![]() |
| Hollow Triangle | Triangle Pattern |
|---|---|
![]() |
![]() |
| Left Triangle | Right Half Pyramid |
|---|---|
![]() |
![]() |
| Reverse Left Half Pyramid | Reverse Right Half Pyramid |
|---|---|
![]() |
![]() |
| Reverse Diamond Pattern | Reverse Hollow Triangle |
|---|---|
![]() |
![]() |
| Number Triangle | Reverse Number Triangle |
|---|---|
![]() |
![]() |
| Number Increasing Pyramid | Number Increasing Reverse Pyramid |
|---|---|
![]() |
![]() |
| Number Changing Pattern | Zero-One Pattern |
|---|---|
![]() |
![]() |
| Mirror Image | Parallelogram |
|---|---|
![]() |
![]() |
| Square Hollow | Right Pascal's Triangle |
|---|---|
![]() |
![]() |
| K Pattern | X Pattern |
|---|---|
![]() |
![]() |
Pattern printing is more than drawing shapes with characters. It develops the core programming skills required for solving algorithmic problems.
Through these exercises, you'll improve your understanding of:
- 🔁 Nested Loops
- 🔀 Conditional Statements
- 📐 Symmetry and Pattern Recognition
- 🔢 Number Manipulation
- 🧩 Problem Solving
- 🧠 Logical Thinking
- 💻 Java Programming Fundamentals
These concepts form the foundation for learning Data Structures & Algorithms (DSA) and preparing for coding interviews.
Follow these steps to run any pattern program on your local machine.
Before getting started, ensure you have the following installed:
- Java JDK 8 or later
- Any Java IDE (VS Code, IntelliJ IDEA, or Eclipse)
- Git (optional, for cloning the repository)
git clone https://github.com/asif-visionary/pattern_printing.gitNavigate to the project directory:
cd pattern_printingNavigate to the desired pattern folder.
Example:
cd butterfly_patternjavac FileName.javaExample:
javac ButterflyPattern.javajava FileNameExample:
java ButterflyPatternThis repository focuses on strengthening Java fundamentals through hands-on pattern printing exercises.
- Nested Loops
- Conditional Statements
- Control Flow
- Iteration
- Output Formatting
- ⭐ Star Patterns
- 🔢 Number Patterns
- ⬜ Hollow Patterns
- 🔺 Pyramid Patterns
- 🦋 Butterfly Pattern
- 🔷 Diamond Pattern
- ✖️ X Pattern
- 🔤 Alphabet Patterns
- 🔄 Mirror Patterns
- 🔢 Pascal's Triangle
- Logical Thinking
- Problem Solving
- Pattern Recognition
- Algorithmic Thinking
- Loop Optimization
- Java Programming Fundamentals
| Technology | Purpose |
|---|---|
| ☕ Java | Programming Language |
| 💻 VS Code | Development Environment |
| 🌐 Git | Version Control |
| 📦 GitHub | Repository Hosting |
This repository is suitable for:
- 👨🎓 Students learning Java
- 💻 Beginners exploring programming
- 📚 College lab practicals
- 🧠 DSA beginners
- 🎯 Coding interview preparation
- 👨🏫 Teachers looking for Java pattern examples
- 🚀 Anyone who wants to improve programming logic
Contributions are welcome!
If you'd like to improve existing programs or add new Java patterns, feel free to contribute.
- Fork this repository
- Create a new branch
git checkout -b feature/new-pattern-
Make your changes
-
Commit your work
git commit -m "Add new Java pattern"- Push to your fork
git push origin feature/new-pattern- Open a Pull Request
Every contribution—whether it's fixing code, improving documentation, or adding new patterns—is appreciated.
If you found this repository helpful:
- ⭐ Star this repository
- 🍴 Fork it
- 📢 Share it with others
- 💡 Suggest new patterns
- 🤝 Contribute improvements
Your support helps make this repository even better for the Java community.
This project is licensed under the MIT License.
Feel free to use, modify, and share the code for educational and personal projects.























