In this tutorial, we are going to write a java program to print a star pattern in square shape in java Programming with practical program code and step-by-step full complete explanation.
Java program to print a star pattern in square shape.
class Pattern12 { public static void main(String args[]) { for(int i=1;i<=5;i++) { for(int j=1;j<=5;j++) { System.out.print("* "); } System.out.println(); } } }
Output
* * * * * * * * * * * * * * * * * * * * * * * * *