1.
public class PrintStar { public static void main(String[] args) { printAttentionStar(); printUpstandDownStar(); printUpAndDownStar(); } /* * ** *** **** ***** */ private static void printAttentionStar() { for(int i=0; i<5; i++){ for(int j=0; j<=i; j++){ System.out.print("*"); } System.out.println(); } } /* ***** **** *** ** * */ private static void printUpstandDownStar() { for (int i = 0; i < 5; i++) { for (int j = 5; j > i; j--) { System.out.print("*"); } System.out.println(); } } /* * ** *** **** ***** ***** **** *** ** * */ private static void printUpAndDownStar() { int index = 0; for (int i = 0; i < 10; i++) { if(index < 5){ for (int j = 0; j <= i ; j++) { System.out.print("*"); } System.out.println(); index++; } if(index >=5){ for (int k = 9; k > index ; k--) { System.out.print("*"); } System.out.println(); index++; } } } }