
你不能 非静态方法是必须在Test类的实例上调用的方法。创建Test的实例以在您的main方法中使用:
public class Test { public static void main(String args[]) { int[] arr = new int[5]; arr = new int[] { 1, 2, 3, 4, 5 }; Test test = new Test(); test.arrPrint(arr); } public void arrPrint(int[] arr) { for (int i = 0; i < arr.length; i++) System.out.println(arr[i]); }}欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)