Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training

Break Statement in JSP

The use of break statement is to escape early from the loop. It allows the program to escape from the for, while, switch and do while loops.

Ads

Break Statement in JSP

        

The use of break statement is to escape early from the loop. It allows the program to escape from the for, while, switch and do while loops. A break may only appear on one of these statements. It is mainly used to escape early from the loop.

In this program we are using the switch statement under which we will use break statement. The for loop will run from 0 to 5. 

The code of the program is given below:

 

 

<html>
<head>
<TITLE> break Statement in jsp</TITLE>
  </HEAD>
 <BODY>
<table>
    <H1>break Statement in jsp</H1>
    <%
		for(int i =0; i <= 5; i++) {
		switch(i){
		case 0:
		out.println(i+ "is zero."+"<br>");
		break;
		case 1:
		out.println(i+ "is one."+"<br>");
		break;
		case 2:
		out.println(i +"is two."+"<br>");
		break;
		case 3:
		out.println(i+" is three."+"<br>");
		break;
		case 4:
		out.println(i+"is four."+"<br>");
		break;
		case 5:
		out.println(i+"is five."+"<br>");
		break;
		default:
			out.println(i+" is greater than 6");
		}
		}
%>
	</table>
  </BODY>
</HTML>

Output of the Program:

 

Download this example.

Advertisements

Share on Google+Share on Google+

Break Statement in JSP

Posted on: March 11, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

Ads
 

Discuss: Break Statement in JSP  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:1
kiran sidhu
July 24, 2013
computer

this is a good job for students who want to study with internet.

Ads

 

Ads