public class Main {
public void solution(int star) {
System.out.println();
}
public static void main(String[] args) {
Main method = new Main();
int star = 9;
method.solution(star);
}
}
해결법
방법 1
public class test02 {
public void solution(int star) {
for (int i = 0; i < star; i++) {
for (int j = 0; j < star-i; j++) {
System.out.print(" ");
}
for (int j = 0; j < i*2+1; j++) {
System.out.print("*");
}
System.out.println();
}
}
public static void main(String[] args) {
test02 method = new test02();
int star = 9;
method.solution(star);
}
}