Explain any errors in the following code. If there is any code that is incorrect
ID: 669773 • Letter: E
Question
Explain any errors in the following code. If there is any code that is incorrect, completely correct and rewrite just the line(s) of code that may be incorrect.
import java.util.Scanner;
public class Question {
public static void main ( String args[] ) {
Scanner yellow = new Scanner ( System.in );
System.out.print ( "Enter a number between 8 and 42: " );
int value = yellow.nextInt();
while ( value < 8 && value > 42 ) {
System.out.print ( "Enter a number between 8 and 42: " );
value = yellow.nextInt();
}
System.out.println ( "Thanks for entering " + value + "!" );
}
}
Explanation / Answer
Code is correct.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.