Question: Consider the Java code segment below: int value = 1 ; while ( value > 0 ) { System.out.println ( Enter a positive value
Consider the Java code segment below:
int value ;
while value
System.out.printlnEnter a positive value or to quit;
value inScan.nextInt;
System.out.printlnYour positive value was value;
What is wrong with the code segment above? Assume that the rest of the program including Scanner initialization is done correctly.
Selected answer will be automatically saved. For keyboard navigation, press updown arrow keys to select an answer.
a
Nothing is wrong it will work correctly.
b
It will have an infinite loop
c
It will not print out the final legal value
d
It will print out the sentinel value
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
