I'm studying SWCD by Charles Lyons (2nd edition) and i'm reviewing some questions about
JSP. On page 262, here's the following question:
Which of the following cause the value 'yes' to be written to the response if the state scripting variable is true and 'no' otherwise?
A. <%=
if (state) {
"yes";
} else {
"false";
}
%>
B. <%=state? "yes" : "no"%>
C. <% if (state) %>yes<%else%>no
D. <% if (state) out.write("yes");
else out.write("no");%>
E. <% state? out.write("yes") : out.write("no");%>
Answer is B & D. I do understand the explanation to the answer given. However nothing is mention about why A is incorrect? I don't see why A is incorrect.
Any help is appreciated.