Convert an Array to a List
public class Main {
public void arrayToList() {
String[] cars = {"Dodge", "Chevrolet", "BMW", "Toyota"};
List
for (String car : carList) {
System.out.println(car);
}
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
new Main().arrayToList();
}
}
0 comments: