import java.util.Arrays;public class HelloWorld {? ? public static void main(String[] args) {? ? ? ? HelloWorld hello = new HelloWorld(); ? ?int[] nums = hello.getArray(8); ? ? System.out.println(Arrays.toString(nums));? }public int[] getArray(int length) {int[] nums = new int[length]; for ( int i=0;i<nums.length;i++ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ) { nums[i]=(int)(Math.random()*100); } return nums; // 返回賦值后的數(shù)組 }}
返回值不是只能有一個值嗎?public int[] getArray(int length)那int[]是咋返回?
慕九州2079353
2016-07-29 12:32:47