ArrayToList.java

Convert String Array Object to String List Object Java

In this tutorial, We will show you How to convert String Array Object to String List Object Java. The program is tested and output is shared in the same post.

package com.dineshkrish;
import java.util.Arrays;
import java.util.List;
public class ArrayToList {
public static void main(String[] args) {
String[] strArray = {
"One", 
"Two", 
"Three", 
"Four", 
"Five", 
"Six", 
"Seven", 
"Eight",
"Nine",
"Ten"
};
// Converting Array Object to List Object
List<String> strList = Arrays.asList(strArray);
// Printing Converted List Object
System.out.println(strList);	
}
}

Output

——————–
[One, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten]

Tags:

No responses yet

Leave a Reply

Your email address will not be published. Required fields are marked *