Nested if Statements : If « JSP « Java Tutorial






<HTML>
  <HEAD>
    <TITLE>Nested if Statements</TITLE>
  </HEAD>

  <BODY>
    <H1>Nested if Statements</H1>
    <%
        double value = 2;

        if (value != 0) {
            if (value > 0)
               out.println("The result = " + (1 / value));
            else
               out.println("Sorry, we need a positive number.");
        }
    %>
  </BODY>
</HTML>








23.6.If
23.6.1.Using the if Statement
23.6.2.Using Compound Statements
23.6.3.Nested if Statements
23.6.4.Using an if-else Ladder