import java.util.Arrays;
import java.util.LinkedList;
public class ArrayToLinkedList {
public static void main(String[] args) {
String [] arr = {"php","cpp","java","html"};
LinkedList<String> list = new LinkedList<String>(Arrays.asList(arr));
for (String str : list) {
System.out.println("element is = "+str);
}
}
}
Output:
element is = php
element is = cpp
element is = java
element is = html
import java.util.LinkedList;
public class ArrayToLinkedList {
public static void main(String[] args) {
String [] arr = {"php","cpp","java","html"};
LinkedList<String> list = new LinkedList<String>(Arrays.asList(arr));
for (String str : list) {
System.out.println("element is = "+str);
}
}
}
Output:
element is = php
element is = cpp
element is = java
element is = html
No comments:
Post a Comment