Java String Array

This is simple java string program. In this
section we will learn how to make use of string array. In the java programming tutorial
string, which are widly used in java program for a sequence of character. String
are represents character string. This program are implemented such as
"rose!" as instance of class. If string are constant, their
values cannot be changed after they are created. A string buffers support
multiple strings. Here in this program we are going to use string type array. We
have to used array as data structure to hold values that are same type. The
array are an alternative to java collection classes such as Arraylist and
LinkList. This program have to going to provide for complete illustration with
java source source below:
Description of program:
In this program you will be read how to use string of
array. First of all, we have to define class named "StringCharacter".
Inside of class we have to define a string of array values. After that we are
going to applying for loop condition as with int "i", i < 5
and i++ as for increment. So output will display on the screen by using println()
system class.
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:\amar work>javac StringCharacter.java
C:\amar work>java StringCharacter
chandan
Amar
tapan
santosh
deepak
C:\amar work> |
Download this Example.

|