Discuss / Java / 练习

练习

Topic source

import java.util.Arrays;

public class main28 {

    public static void main(String[] args) {

        int[] ns = { 28, 12, 89, 73, 65, 18, 96, 50, 8, 36 };

        System.out.println(Arrays.toString(ns));

        Arrays.sort(ns);

        int end = ns.length - 1 ;

        for(int i =0 ; i < ns.length / 2; i ++) {

            int tmp = ns[i] ;

            ns[i] = ns[end] ;

            ns[end] = tmp ;

            end = end - 1;

        }

        System.out.println(Arrays.toString(ns));

    }

}

发错了发错了,这是下一节的练习


  • 1

Reply