首页 » 开发 » JAVA » java常用知识:arrays将数组变成字符串和对数组进行排序

java常用知识:arrays将数组变成字符串和对数组进行排序

 
import java.util.Arrays;
public class Test057{
	public static void main(String[] args){
		int[] intArray = {10,20,30};
		String str1 = Arrays.toString(intArray);
		System.out.println(str1);
		
		int[] intArray2 = {20,10,30};
		Arrays.sort(intArray2);
		System.out.println(Arrays.toString(intArray2));
		
		String[] str2 = {"wo","de","ma","ya"};
		Arrays.sort(str2);
		System.out.println(Arrays.toString(str2));
	}
}

原文链接:java常用知识:arrays将数组变成字符串和对数组进行排序,转载请注明来源!

0