Home Jsp Simple-jsp-example String Arrays Java

Related Tutorials


 
 

Share on Google+Share on Google+

String Arrays Java

Advertisement
String array cannot hold numbers or vice- versa. Jsp arrays can only store the type of data specified at the time of declaring the array variable. An array is a type of container which can hold a fixed number of values of a single type.

String Arrays Java

        

String array cannot hold numbers or vice- versa. Jsp arrays can only store the type of data specified at the time of declaring the array variable. An array is a type of container which can hold a fixed number of values of a single type. Array is a collection of similar data types. It means if you have declared an array as string then it can only store the string values. The length of an array is established when an array is created. After creation of the length, its length can't be changed.

The code of the program is given below:

<%
   String[] country = {"India", "Russia", "America", "England", "Ireland", "Germany"};
   %>
   <body>
   <center>
   <h1>
   <%for (int i = 0; i < country.length; i++) {
  out.print("<p>" + country[i] + "</p>");
   }

%>
<h1>
</center>
</body>

The output of the program is given below:

Download this example:

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



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: March 11, 2008

Related Tutorials

Discuss: String Arrays Java   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com