9. สร้างใหม่จากเก่า

The Camtasia Studio video content presented here requires JavaScript to be enabled and the latest version of the Macromedia Flash Player. If you are you using a browser with JavaScript disabled please enable it now. Otherwise, please update your version of the free Flash Player by downloading here.

 
รหัสที่ 9-40  ตัวอย่างการใช้งาน Arrays.sort กับสตริงที่เป็น Comparable
import java.util.Arrays;
public class SortString {
  public static void main(String[] args) {
    String[] s = {"Java", "C#", "Scala", "Ruby"};
    Arrays.sort(s);
    System.out.println(Arrays.toString(s));
  }
}
©2009 S.Prasitjutrakul