The point is that the println() *does* run in the first example when the if statement evaluates to false. It's still a reachable statement. In the second example, there's no way that the code could...
Type: Posts; User: KevinWorkman
The point is that the println() *does* run in the first example when the if statement evaluates to false. It's still a reachable statement. In the second example, there's no way that the code could...
I don't think you quite understand the question.
In the first code example, the if statement does not have any curly brackets. That means that when the if statement evaluates to true, only the...
This code:
if (number < 1 || number > 100 )
throw new InvalidInputException();
System.out.println("You entered " + number);
Should be re-written as this: