Sponsered Links
Categories
Sponsered Links

Java String Array Example

 

This is a simple Java String Array Example.

public class StringArray {

    public static void main(String args[]) {
       
        String arr[] {"Zero""One""Three"};

        System.out.println("String Array arr ...");
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
        
        String arr1[] new String[]{"Zero""One""Two"};
        System.out.println("\nString Array arr1...");
        for (int i = 0; i < arr1.length; i++) {
            System.out.println(arr1[i]);
        }
       
        String arr2[] new String[3];
       
        arr2[0"Zero";
        arr2[1"One";
        arr2[2"Two";

        System.out.println("\nString Array arr2...");
        for (int i = 0; i < arr2.length; i++) {
            System.out.println(arr2[i]);
        }
    }
}

 


 

 
 
Sponsered Links
Latest Updates
 
All Content of this site is for learning only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright © 2009 JSPSERVLETTUTORIAL.INFO All Right Reserved