Hollow Diamond Pattern in Java2 min read

In this tutorial, we will write a program to print a hollow diamond star pattern in java. We will go through two examples. Before that, you may go through the following topic in java.

The program takes a user input for the number of rows for the hollow pattern using the Scanner class. We will use a for loop to iterate and print the pattern.

The user can give the input number as they wish and get the hollow diamond star pattern according to their input provided.


Java Program To Display Hollow Diamond Star Pattern

Output:

Hollow Diamond Pattern in Java

Print Hollow Diamond Pattern using Star in Java using while loop

The program below takes the rows input from the user as the above program did but here we will produce a hollow diamond pattern using a while loop instead of for loop.

The above program with a while loop will produce the same result as the for loop has produced. The only difference is we used while instead of for loop.


MORE

Find the output ab, cd, ef, g for the input a,b,c,d,e,f,g in Javascript and Python

In this tutorial, we will write a program to find a pairs of elements from an array such that for the input [a,b,c,d,e,f,g] we will …
Read More

String Pattern Programs in C

In this tutorial, we will write various C pattern programs for String. Before that, you may go through the following topics in C. for loop …
Read More

Java Program to Find pair of Integers in Array whose sum is given Number

In this tutorial, we will write a program to find a pair of elements from an array whose sum equals a given number in java …
Read More

Program to Print Diamond Alphabet Patterns in C

In this tutorial, we will learn to write a C program to print Diamond patterns using alphabets/characters. However, in this tutorial, we will create a …
Read More

Half Diamond Pattern in C using Alphabets

In this tutorial, we will learn and code the half diamond alphabet patterns in C programming language. However, in this tutorial, we will create a …
Read More

Half Pyramid of Alphabets in C

In this tutorial, we will learn and code alphabet patterns in C programming language specifically the Half pyramid of alphabets in C programming. However, in …
Read More