Array of Classes NullPointerException

后端 未结 8 1734
悲&欢浪女
悲&欢浪女 2020-12-12 05:17

This is Element class:

public class Element {

    private String elementName;
    private int atomicNumber;
    private String Symbol;
    priv         


        
8条回答
  •  攒了一身酷
    2020-12-12 05:20

    Creating new object arrays will yield arrays filled with null. If you need to have objects, you will have to iterate over the array after its creation and populate it with new instances.

提交回复
热议问题