Analyze the following code:

```
boolean even = false;
if (even = true) {
System.out.println("It is even");
}
```
a. The program has a compile error.
b. The program has a runtime error.
c. The program runs fine, but displays nothing.
d. The program runs fine and displays It is even.


d. The program runs fine and displays It is even.
It is a common mistake to use the = operator in the condition test. What happens is that true is assigned to even when you write even = true. So even is true. The program compiles and runs fine and displays "It is even".

Computer Science & Information Technology

You might also like to view...

____ are people whose job it is to create structures, navigation, and search systems for Web sites.

A. Research Architects B. Research Developers C. Information Architects D. Information Developers

Computer Science & Information Technology

The ____ macro is stored with the document.

A. AutoExec B. AutoClose C. AutoExit D. AutoFit

Computer Science & Information Technology

Early signs of CTS include a feeling of emotional and physical exhaustion. _________________________

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Which 802.11 version has a maximum data rate of 54 Mb/s and uses the 2.4 GHz frequency range?

a. 802.11a b. 802.11b c. 802.11g d. 802.11 n

Computer Science & Information Technology