美文网首页
小练习45

小练习45

作者: 哈迪斯Java | 来源:发表于2023-04-08 09:24 被阅读0次

interface Sortable {
void sort(int arr[]);
}

public class Demo {

public static void main(String[] args) {
    Sortable s = java.util.Arrays::sort;
    int arr[] = { 9, 4, 1, 5, 2, 6, 3 };
    s.sort(arr);
    for (int x : arr) {
        System.out.print(x + " ");
    }
}

}

相关文章

网友评论

      本文标题:小练习45

      本文链接:https://www.haomeiwen.com/subject/mqihddtx.html