Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML


 
  
 
Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML
 

 
Facing Programming Problem?
Ask Questions?, Browse Latest Questions, Question-Answer Guidelines
Java
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments

String Array In Java

                         

In this section, you will learn how to use string array in Java. Here, you will see how to declare a string array and the syntax for using in the program. This section provides you a simple java program which illustrates about the string array in very efficient manner.

Program Description:

Following code of the program declares a string array and store some strings like "chandan", "tapan", "Amar", "santosh", and "deepak" to it. And in the main method these string are displayed one by one by retrieving from the specified string array named roseindia. In this program all the string values are stored in the roseindia string array at the declaration time.

Here is the code of this program:

class StringCharacter 
{
  static String[] roseindia={"chanan","tapan","Amar","santosh","deepak"};
  public static void main(String args[]){
    for(int i=0;i<5;i++){
    System.out.println(roseindia[i]);
    }
  }
}

Output of program:

C:\>javac StringCharacter.java

C:\>java StringCharacter
chanan
tapan
Amar
santosh
deepak

C:\>

Download this Example.

                         

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 

Current Comments

4 comments so far (
post your own) View All Comments Latest 10 Comments:

hi,
how can i declare sentence "remove this" as array,then read array[0]=remove and array[1]=this

Posted by dee on Wednesday, 12.12.07 @ 16:30pm | #41944

Sir,
Can U Give Me An Example on Dynamically Initalizing The Arrays i.e., By Reading Using System.in.read()

Posted by Praneeth Kumar on Wednesday, 12.5.07 @ 10:49am | #41332

Hi Anand,

Thanks for your comments. We have just tested the application and found the output in the following format:

C:\>java StringCharacter
chanan
tapan
Amar
santosh
deepak

You are right the values in the array will be printed in the sequence it was added.

Thanks for your comment.

Posted by Deepak Kumar on Monday, 05.21.07 @ 18:06pm | #16920

class StringCharacter
{
static String[] roseindia={"chanan","tapan","Amar","santosh","deepak"};
public static void main(String args[]){
for(int i=0;i<5;i++){
System.out.println(roseindia[i]);
}
}
}
Output of program:

C:\amar work>javac StringCharacter.java

C:\amar work>java StringCharacter
chandan
Amar
tapan
santosh
deepak

C:\amar work>
My question: Now i want to know that how amar has been chosen between them for treatment?

Posted by Anand Kumar Singh on Monday, 05.21.07 @ 17:22pm | #16918

Latest Searches:
binary recursio
updata into csv
horizontal curved lin
Dojo Progress Bar
<s:iterator>
pthread.h
Determining If a Year
Convert Celsius to Fah
jstl list size
Photoshop Drawing 3D P
saxophone tutorial
add a list box in a fo
prime numbers
create new set in java
retreiving data from a
3DS MAX Modeling the m
insert new coloumn
verifying login detail
calling one jsp p
ajax examples java
clear values from a fo
insert data to text fi
multi box
phone number validatio
Web Focus
linked list exception
how to use tab control
tibco
clear the screen in ja
retrive data from data
Interview Questions -
ActionErrors in struts
how to use ejb 3.0 in
comparing the elements
cololection examples
jpasswordfield
i want to load a jFram
split string
how to insert large im
median
Handling Multiple Subm
Combattons la programm
how to read txt file f
jsp bean get property
transact
compiler design
Flash Math Physics Mas
birt
jpanel
Eclipse 3.4 EJB
printing jdbc batch qu
trim().length()
update
h:inputtext tag in jsf
StringTokenizer select
JFreechart Library:Lin
Icon
DefaultMutableTreeNode
combo box my sql
checkbox button enable
clear the console in j
mqseries
s:set
Visual Basic Networkin
input string in array
set cell value JTable
jsp Insert data in mys
Session in Servlet
requestdispatcher in j
carters as a pimp draw
using next and previou
scroll
<t:dataScroller
read from application
OCTAL TO DECIMAL WITH
How to get data from d
Create PDF from browse
struts-blank.war
split
TextArea Frame in Java
Java String toLowerCase Example
Java String toCharArray Example
Java String substring Example
Java String indexOf Example
Java String startsWith Example
Java String hashCode Example
Java String matches Example
Java String length Example
Java String lastIndexOf Example
Java String isEmpty Example
Java String equalsIgnoreCase Example
Java String equals Example
Java String endsWith Example
Java String copyValueOf Example
Java String contentEquals Example
  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

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 | 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.