Java Array Initial Values

In this chapter you will learn:

  1. What are the Java Array Initial Values
  2. Initial value for Java array

Description

After we allocate memory for a Java array, Java assigns each element in an array to its initial values

Initial value

The initial value is zero in the case of an array of numerical values, is false for boolean arrays, is '\u0000' for arrays storing type char, and is null for an array of objects of a class type.

The following table lists the default value for various array types.

Element Type Initial Value
byte 0
int 0
float 0.0f
char '\u0000'
object referencenull
short 0
long 0L
double 0.0d
boolean false

Next chapter...

What you will learn in the next chapter:

  1. What is Java Array Length
  2. Syntax for Java Array Length
  3. Example - Java Array Length
Home »
  Java Tutorial »
    Java Langauge »
      Java Array
Java Array
Java Array Variables
Java Array Initial Values
Java Array Length
Java Initialize Arrays
Java Array Index
Java Array for each loop
Java Multidimensional Arrays