Using an if-else Ladder : Statements « JSP « Java






Using an if-else Ladder

<HTML>
  <HEAD>
    <TITLE>Using an if-else Ladder</TITLE>
  </HEAD>

  <BODY>
    <H1>Using an if-else Ladder</H1>
    <%
        String day = "Friday";

        if(day == "Monday")
            out.println("It\'s Monday.");
        else if (day == "Tuesday")
            out.println("It\'s Tuesday.");
        else if (day == "Wednesday")
            out.println("It\'s Wednesday.");
        else if (day == "Thurssday")
            out.println("It\'s Thursday.");
        else if (day == "Friday")
            out.println("It\'s Friday.");
        else if (day == "Saturday")
            out.println("It\'s Saturday.");
        else if (day == "Sunday")
            out.println("It\'s Sunday.");
    %>
  </BODY>
</HTML>

           
       








Related examples in the same category

1.Using the continue Statement
2.Using the break Statement
3.While statement
4.While: Finding a Factorial
5.Using the while Loop
6.For loop: Using Two Loop Indexes
7.Using the if Statement
8.Testing for Multiple Conditions
9.Using the switch Statement
10.Nested if Statements
11.Using Compound Statements