Enter your E-mail Address below for Free E-mail Alerts right Into your Inbox: -

Sunday

String Array in Java with Examples

String Array in Java with Examples

Array is a container to store some values of a single type.The length of the array is fixed at the time of creation and it can't be changed. The String array is used to store String values. In String array you can't store other types.

public final class Test {

static String[] strArray = new String[10];

    public static void main(String args[])
    {
    strArray[0]="abc";
    strArray[1]="def";
    strArray[2]="ghi";
    strArray[3]="jkl";
    strArray[4]="mno";
   
    for(int i=0;i<strArray.length;i++)
    {
    System.out.println(strArray[i]);
    }
    }
    }

No comments:

Post a Comment