String Array is a container object that holds a fixed number of String values. The length of an String array is established when the array is created. After creation, its length is fixed.
Each item in an String array is called an element, and each element is accessed by its numerical index which starts with 0.
Declaring a String arrays :
String names[] = new String[3]; // Declaring a String array with size String names[] = {"Prem", "Siva", "Mahesh", "Srinath"}; // Declaring a String array with elements String names[] = new String[]{"Prem", "Siva", "Mahesh", "Srinath"}; // Other way of declaring String Arrays Demo CODE class StringArrayDemo OUTPUT Prem DESCRIPTION In the above program we declared a THINGS TO TRY
|