What is wrong with the following code fragment? Rewrite it so that it pro¬duces correct output.
```
if (total == MAX)
if (total < sum)
System.out.println("total == MAX and < sum.");
else
System.out.println("total is not equal to MAX");
```
Despite the indentation, the else clause is associated with the immediately preceding if rather than the first if. The program will produce the correct output if it is rewritten as:
```
if (total == MAX)
{
if (total < sum)
System.out.println("total == MAX and < sum.");
}
else
System.out.println("total is not equal to MAX");
```
You might also like to view...
Discuss the aim of the personnel security process.
What will be an ideal response?
To determine whether a program is running or hung up you would go to the ________ tab
A) Processes B) Services C) Details D) Connections
The _______ and _______ operators are used to shift the bits of a value to the left or to the right, respectively.
Fill in the blank(s) with the appropriate word(s).
_____ help clarify and emphasize details, so they appeal to audience members with differing backgrounds, reading levels, attention spans, and motivations.
A. Icons B. Outlines C. Graphics D. Typefaces