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...
Excel provides pre-defined styles called templates that help you quickly format an entire worksheet or area
Indicate whether the statement is true or false
Computer Science & Information Technology
To be able to send and receive messages in parallel over a network connection, a program must use __________ of execution.
a. one thread. b. two threads. c. three threads. d. four threads.
Computer Science & Information Technology