Write a code fragment that reads and prints integer values entered by a user until a particular sentinel value (stored in SENTINEL) is entered. Do not print the sentinel value.

What will be an ideal response?

```
Scanner scan = new Scanner(System.in);
System.out.print("Enter some integers (" + SENTINEL +
" to quit): ");
number = scan.nextInt();
while (number != SENTINEL)
{
System.out.println(number);
number = scan.nextInt();
}
```

Computer Science & Information Technology

You might also like to view...

A technician has replaced a riser inside a server and the riser is failing again after reboot. Which of the following should have been used when initially replacing the riser?

A. Compressed air B. Vacuum cleaner C. Proper cable management D. ESD mat

Computer Science & Information Technology

You use the Private keyword to create a class-level array.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology