Its very often scenario to convert String Array to list in real time projects . In java we have inbuilt function to convert String array to List.
Syntax:
Arrays.asList(“Input String array“);
Java String Array to List Example
RemoveNonNumeric.java
import java.util.Arrays;
import java.util.List;
public class RemoveNonNumeric {
public static void main(String[] args) {
String[] str = {"mycareerrepublic","Rahul"};
List<String> list = Arrays.asList(str);
System.out.println(list);
}
}
Output: [mycareerrepublic, Rahul]
0 comments:
Post a Comment