Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Declaring string array 
 

An array is the collection of same data type. Suppose if we have a declare an array of type String, then it will store only the String value not any other data type. When we have a closely related data of the same type and scope, it is better to declare i

 

Declaring string array

                          

An array is the collection of same data type. Suppose if we have a declare an array of type String, then it will store only the String value not any other data type. When we have a closely related data of the same type and scope, it is better to declare it in an array. 

In this example we have declared an array of  type String inside the scriptlet directive. The output will be displayed by using the out implicit object which is provided to us by jsp to display the message on the browser. 

The code of the program is given below:

 

 

<HTML>
  <HEAD>
    <TITLE>Declaration of an Array</TITLE>
  </HEAD>
 <BODY>
 <FONT SIZE="6" COLOR="#660000">Declaration of an Array</FONT>
 <table align="center" bgcolor="#CCFFFF" border="1">
 <tr><td><H3>Declaration of an Array</H3></td></tr>
   <tr><td> 
    <%
	String weeks_days[] = new String[7];
	weeks_days[0] = "Sunday";
	weeks_days[1] = "Monday";
	weeks_days[2] =	"Tuesday";
	weeks_days[3] =	"Wednesday";
	weeks_days[4] = "Thursday";
	weeks_days[5] =	"Friday";
	weeks_days[6] =	"Saturday";
	out.println(" " + weeks_days[1]);
	out.println("<br>" + weeks_days[2]);
	out.println("<br> " + weeks_days[3]);
	out.println("<br> " + weeks_days[4]);
	out.println("<br> " + weeks_days[5]);
	out.println("<br>" + weeks_days[6]);
	
	out.println("<br>Sunday is a holiday " + weeks_days[0]);
       
     %>
	 </td></tr>
	 </table>
  </BODY>
</HTML>

Output of the Program:

 

Download this example.

                          

» View all related tutorials
Related Tags: java c library error ide io vi core tag lock this id action block write invoke like handle if solution

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.