Go Back

Program to convert Array to List in Java

7/25/2021
All Articles

#java_array #array #list #java

Program to convert Array to List in Java

Program to convert Array to List in Java

Array in 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

List in  java 

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.

for more info visit java Doc

Example :



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);
}
}


 

Conclusion 

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.

Article