Home Jsp Simple-jsp-example If- Else Ladder
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

If- Else Ladder

Advertisement
A ladder means a vertical set of steps. It is a computer generated list of pairings used in eliminations.

If- Else Ladder

        

A ladder means a vertical set of steps. It is a computer generated list of pairings used in eliminations.

In this example we are declaring a variable month of type String and initialize it with the value "January". We are using If- Else loop for the ladder. The loop will travel up to down and if the condition gets true then it will get out of the loop. We have defined the if- else condition inside the scriptlet. Scriptlet tag is used for the implementation of the business logic of the program.

 

The code of the program is given below:

 

 

<HTML>
  <HEAD>
    <TITLE>Using an if-else Ladder</TITLE>
  </HEAD>
  <BODY>
    <font bgcolor = "red" size = 10>
           Using an if-else Ladder</font>
    <%
        String month = "January";
        if(month == "January")
            out.println("It\'s January.");
        else if (month == "February")
            out.println("It\'s February.");
        else if (month == "March")
            out.println("It\'s March.");
        else if (month == "April")
            out.println("It\'s April.");
        else if (month == "May")
            out.println("It\'s May.");
        else if (month == "June")
            out.println("It\'s June.");
        else if (month == "July")
            out.println("It\'s July.");
		else if (month == "August")
            out.println("It\'s August.");
        else if (month == "September")
            out.println("It\'s September.");
        else if (month == "October")
            out.println("It\'s October.");
        else if (month == "November")
            out.println("It\'s November.");
        else if (month == "December")
            out.println("It\'s December.");
    %>
  </BODY>
</HTML>

The output of the program is given below:

Download this example.

Advertisements

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: February 7, 2008

Ask Questions?    Discuss: If- Else Ladder  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
neha
February 16, 2013
if-else

defination: if-else ladder constant
DMCA.com