

String myarray //String array declaration without size String myarray = new String //String array declaration with size Given below are the two ways of declaring a String Array. with a size or without specifying the size.

Declaring A String ArrayĪ String Array can be declared in two ways i.e. In this tutorial, we will discuss the string array in Java in detail along with the various operations and conversions that we can carry out on string arrays. You can do all the operations on String array like sorting, adding an element, joining, splitting, searching, etc. This is because each element is a String and you know that in Java, String is an object. If you remember, even the argument of the ‘main’ function in Java is a String Array. String array is one structure that is most commonly used in Java. Thus, we can define a String Array as an array holding a fixed number of strings or string values. We can have an array with strings as its elements. Search For A String In The String Array.
