Java array initialization | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Java array initialization

I've been told that declaring variables in the top of the code and to initialize them later when needed is good practice and improves readability. Is this true and if so, does it also hold for arrays?

5th Feb 2017, 8:43 PM
Joachim Pilgren
Joachim Pilgren - avatar
2 Answers
+ 1
yes.. It is good practice. Do it
5th Feb 2017, 10:06 PM
LordHill
LordHill - avatar
0
and yes, arrays as well
5th Feb 2017, 10:06 PM
LordHill
LordHill - avatar