Java-Array of String

Array of String

You can place objects of string into arrays. This is done in the same way as for character. The string representation consists of a list of the array’s elements, enclosed in braces (“{}”). Adjacent elements are separated by the string”,”.

Program


1

Program Source

public class Javaapp {

    public static void main(String[] args) {
       
        String[] names = {"haj","sar","man","kan"};
        for(int i=0;names.length;i++)
        {
            System.out.println("names["+i+"] = "+names[i]);
        }
    }
}

Leave a Comment