/ *
Java.util.Arrays is associated with an array of tools, which provides a number of static methods used to implement an array of common operations.
public static String toString (array): The parameter array into a string (in accordance with the default format: [element 1, element 2, element .... 3])
public static void Sort (array): ascending order by default (small to large) array sorts the elements.
* /
import java.util.Arrays;
public class Demo01Arrays {
public static void main(String[] args) {
int[] intArray = {10, 20, 30};
// 将int[]数组按照默认格式变成字符串
String intStr = Arrays.toString(intArray);
System.out.println(intStr); // [10, 20, 30]
int[] array1 = {2, 1, 3, 10, 6};
Arrays.sort(array1);
System.out.println(Arrays.toString(array1)); // [1, 2, 3, 6, 10]
String[] array2 = {"bbb", "aaa", "ccc"};
Arrays.sort(array2);
System.out.println(Arrays.toString(array2)); // [aaa, bbb, ccc]
}
}