What is the default value of the elements of an array?
Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.
What is the default value of the elements of an array?
Rating:
As soon as an array is created using a new operator, its elements are automatically initialized to their default values. This automatic initialization of the elements depends on the data type of the array. The following table shows the initial value of the elements of an array:
| boolean | false |
| byte | 0 |
| short | 0 |
| int | 0 |
| long | 0L |
| char | 'u0000' |
| float | null |
| double | 0.0D |
| Object reference | null |
Rating:
Was this information helpful?
Other articles
- What is a thin client?
- What are the differences between AWT and Swing?
- What is a Try/Catch block?
- String Handling
- What are unary + and - operators?