------解决方案-------------------- int[] array = new int[5]; for(int i = 4; i <= 9; i++){ array[i] = i; }
是这个意思吗?
------解决方案--------------------
------解决方案-------------------- import java.util.Arrays; public class ArraySort{ public static void main(String args[]){ ArraySort as = new ArraySort();
int[] a = {6,23,45,12,-83,94,41}; as.showIntArr(a); Arrays.sort(a); as.showIntArr(a); System.out.println(); String[] s = {"Lisa","祝英台","Billy","Kacy","梁山伯"}; as.showStringArr(s); Arrays.sort(s); as.showStringArr(s); }