Home Java Beginners String Array In Java



String Array In Java
Posted on: June 5, 2007 at 12:00 AM
In this section, you will learn how to use string array in Java.

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.

Related Tags for String Array In Java:
cstringarrayanttimestringsiomethoddisplayvivaluenamethisdeclarationailikeifieprogramvaluestoramstorecishemainitlispltriepeimfrominsanmntplaytrososispndaclesdeclarespectapallnamedmepropanstoredtorsspsoeeatratiokishaimellrayfollowdiadeepandarcodcodestrsavinwingvassriringthstatiapaludispeclplprndodeonomogrolo


More Tutorials from this section

Ask Questions?    Discuss: String Array In Java   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.