gpt4 book ai didi

java - 为什么我的代码在运行此代码时打印 [I@87816d?

转载 作者:行者123 更新时间:2023-11-29 07:03:45 24 4
gpt4 key购买 nike

<分区>

/*
* Given an array of positive ints, return a new array of length "count" containing the
* first even numbers
* from the original array. The original array will contain at least "count" even numbers.
*/

public class StringEx
{

public static void main(String[] args)
{
int[] nums = {2,3,5,6,8};
int count = 2;
StringEx s1 = new StringEx();
System.out.println(s1.copyEvens(nums, count));

}
public int[] copyEvens(int[] nums, int count)
{
int[] n=new int[count];
int c=0;

for(int i=0;i<nums.length;i++)
{
if(nums[i]%2==0&&c!=count)
{
n[c]=nums[i];
c++;

}
}

return n;
}
}

// Output:[I@87816d

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com