我想编写一个 java 应用程序,它可以根据用户的需要打印尽可能多的星星。程序将询问用户他想要打印多少次启动。这是我的代码:
import java.util.Scanner;
public class lab {
public static void main(String[] args){
int StarsN;
Scanner input;
input = new Scanner(System.in);
System.out.println("How many stars do you need?");
StarsN= input.nextInt();
}
public static void loopz(String[] args) {
int loopEnd = StarsN;
int loopStart;
for (loopStart = 0;loopStart==loopEnd;loopStart++) {
System.out.print("*");
}
}
}