176. 'String' data type arrays

'String' data type array -

String defined arrays can store more than one words as shown in the below example -

Example -

String a[] = new String[3];

a[0] = "Selenium"
a[1] = "By"
a[2] = "Arun"

The above example represents a single dimensional String type array. We can also implement 2 dimensional, 3 dimensional arrays using the String data type. But in this post, I will only implement single dimensional String data type array.

Lets implement this on Eclipse IDE -

1.Launch Eclipse IDE, open Java Project 'Project Arrays' and create a Java Class 'StringTypeArray' with main( ) method as shown below -

2. Write the below code to print the values stored in the array elements as shown below -

3. Run the Java Class and observe that the values in the array elements got displayed in the output as shown below -

This is how we implement the String type arrays.

Lets implement the object arrays in the next post.

Please comment below to feedback or ask questions.

Defining and Creating Objects will be explained in the next post.

No comments: