如何清空基本数组? [英] How do I empty a primitive array?

查看:50
本文介绍了如何清空基本数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下课程:

public class Person {

    private String id;

    private Score[] scores;

    public Person() {
    }

    //getters and setters etc
}

如何最好地删除此对象的scores数组中的所有 Score 对象?

How can I best remove all the Score objects within the scores array for this object?

推荐答案

重新初始化数组 new Score [size] 或使用 Arrays.fill 方法.

re initialize the array new Score[size] or Use Arrays.fill method.

这篇关于如何清空基本数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆