小编Nan*_*dan的帖子

为什么我的代码打印[I @ 87816d当我运行此代码?

/*
 * 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)
            { …
Run Code Online (Sandbox Code Playgroud)

java arrays

1
推荐指数
1
解决办法
193
查看次数

标签 统计

arrays ×1

java ×1