Java中字符串排序

Java中字符串排序

Java中字符串排序

package com.fs.test;

import java.util.ArrayList;

import java.util.Collections;

import java.util.List;

public class Listdemo {

public void m1() {

List<String> list = new ArrayList<String>();

list.add("a");

list.add("c");

list.add("b");

list.add("w");

list.add("s");

list.add("a");

list.add("b");

list.add("s");

list.add("d");

list.add("c");

list.add("a");

System.out.println("排序前:" + list);

Collections.sort(list);

System.out.println("排序后:" + list);

}

public static void main(String[] args) {

new Listdemo().m1();

}

}

分享到 :
相关推荐

Leave a Reply

Your email address will not be published. Required fields are marked *