๐ŸŽ‰ Special Offer !    Code: GET300OFF    Flat โ‚น300 OFF on every Java Course
Grab Deal ๐Ÿš€

Mirror Half Diamond Star Pattern Program in Java  


Program:
        *
      * *
    * * *
  * * * *
* * * * *
  * * * *
    * * *
      * *
        *
  • Below is the program:
    public class StarPattern6
    {
        public static void main(String[] args)
        {
            // Upper half of the pattern
            for (int i=1; i<=5; i++)
            {
                for(int j=4; j>=i; j--)
                {
                    System.out.print(" ");
                }
                for (int k=1; k<=i; k++)
                {
                    System.out.print("*");
                }
                System.out.println();
            }
            // Lower half of the pattern
            for(int i=1; i<=4; i++)
            {
                for(int j=1; j<=i; j++)
                {
                    System.out.print(" ");
                }
                for(int k=4; k>=i; k--)
                {
                    System.out.print("*");
                }
                System.out.println();
            }
        }
    }