Respuesta :

Answer:

int x = 1;

while (x <= 7) {

 System.out.println("in a loop");

 ++x;

}

this should work in java

Explanation:

the ++x increments x, so it works lke this:

1. x is 1, prints the thing, then increments x to 2

2. x is 2, prints the thing, then increments x to 3

3. x is 3, prints the thing, then increments x to 4

4. x is 4, prints the thing, then increments x to 5

5. x is 5, prints the thing, then increments x to 6

6. x is 6, prints the thing, then increments x to 7

7. x is 7, prints the thing, then increments x to 8

8. loop stops because 8 is not <= 7

hope this helps :D

btw this could also be done like this using for loop:

for (int x = 1; x <= 7; ++x) {

   System.out.println("in a loop");

}

Following are the program to the given question:

Program Explanation:

  • Defining a class "Main".
  • Defining the main method inside this an integer variable "x" and a while loop is defined.
  • Inside the loop, it checks x value less than equal to 7 and used a print method that prints the a value, and increments the value of x by 1.

Program:

public class Main//defining a class Main

{

public static void main(String[] args)//defining a main method

{

    int x = 1;//defining an integer variable x that initialize with 1

    while (x <=7) //defining a loop that checks x value less than equal to 7

       {

           System.out.println("in a loop");//print message

           x++;//incrementing the value of x by 1

       }

}

}

Output:

Please find the attached file.

  • Therefore, the fill in the blank value is "7 and x".

Learn more:

brainly.com/question/25916519

Ver imagen codiepienagoya
ACCESS MORE
EDU ACCESS
Universidad de Mexico