package com.kuang.array;
import java.util.Arrays;
/**
* @program: JavaSE
* @description:
* @author: lijiaoyang
* @create: 2021-06-23 19:56
**/
class ArrayDemo06 {
public static void main(String[] args) {
int[] a={1,3,9999,56575,6556,656,45,455};
//打印数组元素Array.toString
System.out.println(Arrays.toString(a));
//数组填充
Arrays.fill(a, 0);//括号内只用敲出来'a,' '0'即可,其余自动生成
System.out.println(Arrays.toString(a));
Arrays.fill(a,2,4,9);
System.out.println(Arrays.toString(a));
//数组进行排序
Arrays.sort(a);//1.首先将数组进行排序,排序后仍赋值给数组a
System.out.println(Arrays.toString(a));//再将排序后数组打印出来
}
}
Arrays类
最新推荐文章于 2024-08-15 00:11:50 发布