Array List
//konversi array ke list
import java.util.Arrays;
import java.util.Collections;
import java.util.*;
import java.io.*;
public class arraylist
{
public static void main(String args[])
{
String[] strArray = new String[] {"Merah", "Putih", "Biru", "Hijau","Ungu"};
List ls = Arrays.asList(strArray);
Collections.sort(ls);
System.out.println(ls);
}
}
0 komentar:
Posting Komentar