initializing a boolean array in java

前端 未结 6 1112
花落未央
花落未央 2020-12-23 08:35

I have this code

public static Boolean freq[] = new Boolean[Global.iParameter[2]];
freq[Global.iParameter[2]] = false;

could someone tell m

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-23 09:27

    They will be initialized to false by default. In Java arrays are created on heap and every element of the array is given a default value depending on its type. For boolean data type the default value is false.

提交回复
热议问题