求代码,用java语言

2025-01-02 22:58:44
推荐回答(2个)
回答1:

import java.util.ArrayList;
import java.util.Collections;

public class test {
public static void main(String[] args) {
int a = 3;
int c = 6;
int b = 5;
int e = 2;
int f = 4;
ArrayList list = new ArrayList();
list.add(a);
list.add(c);
list.add(b);
list.add(e);
list.add(f);
Collections.sort(list);//对list进行排序
System.out.println(list);
}
}

回答2:

讲真 这玩意很简单 但是会写的都懒得写