Program to convert Array to List in Java
#java_array #array #list #java
An array is a container object that holds a fixed number of values of a single type. The length of an array is established when the array is created. After creation, its length is fixed. You have seen an example of arrays already,
read more about array from java Doc
An ordered collection (also known as a sequence). The user of this interface has precise control over where in the list each element is inserted. The user can access elements by their integer index (position in the list), and search for elements in the list.
import java.util.*;
public class StringArrayTest
{
public static void main(String args[])
{
String [] words={"ace","boom","crew","dog","eon"};
List wordList=Arrays.asList(words);
for(String e: wordList)
System.out.println(e);
}
}
Here we learn how to convert Array to List in Java.
What is Array and list ?
Hope you like this article for latest update follow out page on instagram and Facebook.