Java如何跳回While循环

Java如何跳回While循环,java,Java,因此,如果LARGE不等于Count,则LARGE应递增,直到Count和LARGE具有相同的值。之后,我的教授想再次输入一个新的整数,然后它将再次循环,但我不知道如何使我的代码在时返回到 if (LARGE == Count) { System.out.println ("Large is Equal to Count"); } while (Count != LARGE) { LARGE++; System.out.println ("Large is " +LAR

因此,如果
LARGE
不等于
Count
,则
LARGE
应递增,直到
Count
LARGE
具有相同的值。之后,我的教授想再次输入一个新的整数,然后它将再次循环,但我不知道如何使我的代码在时返回到

if (LARGE == Count)
{
    System.out.println ("Large is Equal to Count");
}

while (Count != LARGE)
{
    LARGE++;
    System.out.println ("Large is " +LARGE);
}

if (LARGE == Count)
{
    System.out.println ("Input a new integer to compare")
    LARGE = input.newInt();
}

据我所知,这是你想要的

public static void main(String[] args) {

        int LARGE = 0;
        int Count = 0;
        String s = null;
        Scanner sc = new Scanner(System.in);
        do {

            LARGE = sc.nextInt();
            Count = sc.nextInt();

            if (LARGE == Count) {
                System.out.println("Large is Equal to Count");
            } else {
                do {
                    LARGE++;
                    System.out.println("Large is " + LARGE);
                } while (Count != LARGE);

                if (LARGE == Count) {
                    System.out.println("Large is Equal to Count");
                    System.out.println("Input a new integer to compare");
                }

            }

            System.out.println("Do you want to continue? If yes then Press Y");
            s = sc.next();
        } while (s.equalsIgnoreCase("Y"));

    }

教授想输入多少次新的整数,永远? 我假设了1000次。 如果是永久性的,则将中的“times”替换为true,而大括号中的其他值将有意义的值指定为“times”,而不是1000

System.out.println ("Input a new integer to compare")
LARGE = input.newInt();
int times = 1000; // number of times prof want to enter new integer.
int loop = 0;
while(times > loop ){
    while (Count != LARGE)
    {
        LARGE++;
        System.out.println ("Large is " +LARGE);
    }
    System.out.println ("Input a new integer to compare")
    LARGE = input.newInt();
    loop++;
}

谢谢,我只是一个学习CS的一年级学生,但现在的问题是,当大的不等于计数时,它将无限循环,不管怎样,在代码中,你编写的其他操作与其他操作相同,如果?我只是新来的,嗯,接受按钮在哪里,对不起,哈哈,接受了,先生,谢谢:)让我在大的不等于计数时修复无限循环谢谢,先生,谢谢。如果你有时间,你能给我解释一下字符串S=Null和while(S.equalsIgnoreCase(“Y”)的用法吗;查看google上的字符串比较操作,你会看到许多与之相关的结果。虽然(s.equalsIgnoreCase(“Y”)帮助我需要对此的解释我接受的答案是正确的,但这是代码我无法解释谢谢有人的帮助