While printing ArrayList multipe value it displays only -> '[]'

前端 未结 2 1162
無奈伤痛
無奈伤痛 2021-01-29 03:15

I have a problem with displaying the elements of the ArrayList in Java. While returning the ArrayList when its called from the Views to BMIAnalyzier cl

2条回答
  •  礼貌的吻别
    2021-01-29 03:59

    The main mystery is that you have the Records class extend ArrayList. I have no idea why you are doing that, but in so, you are inheriting ArrayList's toString() method, which is what renders the [], since the array is empty. You need to implement toString() for the Records class.

    String toString() {
        return subjectId + " " + height + " " + width + " " + bmianalyzier + " " + categories;
    }
    

提交回复
热议问题