Example program for Decision Making Statements
Hi all, This is the Decision - Making Statements example program in jsp , using this program you can easily understand how it's work, for best practice just copy & paste this code in your jsp files.
---------------------------------------------------------------------------------------------------------------------
prg: 1
---------------------------------------------------------------------------------------------------------------------
<%! int day = 3; %>
<html>
<head><title>IF...ELSE
Example</title></head>
<body>
<% if (day == 1 | day == 7) { %>
<p> Today
is weekend</p>
<% } else { %>
<p> Today
is not weekend</p>
<% } %>
</body>
-----------------------------------------------------------------------------------
prg: 2
--------------------------------------------------------------------------------------------------------------------
<%! int day = 3; %>
<html>
<head><title>SWITCH...CASE Example</title></head>
<body>
<%
switch(day) {
case 0:
out.println("It\'s Sunday.");
break;
case 1:
out.println("It\'s Monday.");
break;
case 2:
out.println("It\'s Tuesday.");
break;
case 3:
out.println("It\'s Wednesday.");
break;
case 4:
out.println("It\'s Thursday.");
break;
case 5:
out.println("It\'s Friday.");
break;
default:
out.println("It's Saturday.");
}
%>
</body>
</html>
If this information is important to you , and you want to , I will continue writing some more details of programming language, so click on the advertising, available on this page. This is motivate me for writing some more blogs.
Comments
Post a Comment