方法調(diào)用?import java.util.*;public class K2 {? ? public static void main(String[] args) {? ? ? ? ?// 創(chuàng)建對象,對象名為hello? ??L3 hello = new L3();這里報錯求大神指點(diǎn)哪里錯誤int[] nums = hello.getArray(8);? ? ? ? // 將數(shù)組轉(zhuǎn)換為字符串并輸出System.out.println(Arrays.toString(nums));? ? }? ? class L3? ? {public int[] getArray(int length){? ? ? ? // 定義指定長度的整型數(shù)組int[] nums = new int[length];for ( int i=0;i<nums.length;i++ ) {? ? ? ? ? ? nums[i]=(int)(Math.random( )*100); ? ? ??}return nums;}? ? }}
方法的調(diào)用
黃森h(huán)uang
2016-09-17 18:41:18