Use for loop to display string array : String « JSP « Java Tutorial






<%--
  Copyright (c) 2002 by Phil Hanna
  All rights reserved.
  
  You may study, use, modify, and distribute this
  software for any purpose provided that this
  copyright notice appears in all copies.
  
  This software is provided without warranty
  either expressed or implied.
--%>
<%@ page session="false" %>
<%
   String[] colors = {"red", "green", "blue"};
   for (int i = 0; i < colors.length; i++) {
      out.print("<P>" + colors[i] + "</p>");
   }
%>








23.4.String
23.4.1.Creating a String
23.4.2.Getting String Length
23.4.3.Use for loop to display string array