• 2022-06-09
    (7-13)请阅读程序,写出程序运行结果。 //运行结果题 public class Demo4 { public static int print(Object obj) { int []arr; int sum=1; if(obj instanceof int[]) { arr=(int[])obj; for(int x:arr) { sum=arr.length+sum; } } return sum; } public static void main(String[] args) { int []arr= {1,2,3,4,5}; String [] list= {"孙悟空","猪八戒","唐僧"}; System.out.println(print(arr)+print(list)); } }