Printing patterns
Write a program that prints the following patterns on the screen:
********** ******** ****** **** **The first line contains 10 stars. Use a constant variable to store this value.
Your code should use the folowing two methods:
/* This method prints n stars on the same line, no newline */ void printStars(int n) { ... }
/* This method prints n spaces on the same line, no newline */ void printSpaces(int n) { ... }The body of your main shoud use these two methods to print the pattern. For instance, the code below
printStars(8); System.out.println(); int i = 0; while (i <= 4) { printStars(2); printSpaces(4); printStars(2); System.out.println(); i++; } printStars(8); System.out.println();gives the following pattern:
******** ** ** ** ** ** ** ** ** ********