Usually, we have different patterns that are used in Java. In this program, we are using a star pattern to be printed in Java. This gives a brief introduction to the sand hourglass program.
This program describes the star pattern present in Java. This program is introduced to get a little awareness about the patterns in Java language. In Java, we have different patterns like Star pattern, Number pattern, Character pattern. In the star pattern, we have different patterns like diamond pattern, pyramid pattern, Sand hourglass pattern and so on. In this program, we are creating a little awareness regarding sand hourglass pattern in Java. We are using for loop. At first, we are declaring the size of a pattern after that considering a for loop with a variable I and again two for loops are included in it with a variable j and k and with our required conditions. Again, a for loop is considered with two nested for loops in it with our required conditions and printing our convenient subject in it. We can print a Java pattern program in different designs. To develop a pattern program we need knowledge regarding for loop and a do-while loop. The first for-loop works for the row and the second loop works for the column. In pattern programs, Java for loop is widely used.
Submitted by YANIGANTI SUCHITRA (Suchitra)
Download packets of source code on Coders Packet
Comments