Java 我如何设法返回到行代码?

Java 我如何设法返回到行代码?,java,Java,在我的代码中,如何返回到第一行代码。 因此,输出将是: 必须将值设置为100到99999之间 写下你想发送多少数据包:(在100-99999之间) 二, 必须将值设置为100到99999之间 写下你想发送多少数据包:(在100-99999之间) 二百 因此,每次输入错误的号码时,第一行将显示,直到正确为止 System.out.println("\n Write how much packets you want to send : (between 100 - 99999)");

在我的代码中,如何返回到第一行代码。 因此,输出将是:

必须将值设置为100到99999之间

写下你想发送多少数据包:(在100-99999之间)

二,

必须将值设置为100到99999之间

写下你想发送多少数据包:(在100-99999之间)

二百

因此,每次输入错误的号码时,第一行将显示,直到正确为止

    System.out.println("\n Write how much packets you want to send : (between 100 - 99999)");
    int min = 100;
    int max = 99999;
    int packets = scan.nextInt();

    if (packets >= min && packets <= max) {

        System.out.println("You have sended : " + packets + " packets");


        System.out.println("\n Attack is processing...");
        try {

            Thread.sleep(5000);
        }
        catch (InterruptedException ex)
        {

        }

        System.out.println("\n Attack is done");

        try {
            Thread.sleep(1000);
        }
        catch (InterruptedException ex)
        {

        }

    }else {

        System.out.println("You have to put a value between 100 and 99999");
        // Here I want to return to line 1
    }
System.out.println(“\n写下要发送多少数据包:(100-99999之间)”;
int最小值=100;
int max=99999;
int packets=scan.nextInt();

如果(数据包>=min&&packets尝试
while
循环

boolean isRescanRequired = true;
while(isRescanRequired){
    // your scanning code goes here
    if (packets >= min && packets <= max) {
        // your processing and sleep code
        isRescanRequired = false;
    }
}
boolean isRescanRequired=true;
while(isRescanRequired){
//你的扫描码在这里
如果(数据包>=min&&packets,请查看