From 92b88ea3522861d64a31739545fdb95b483a626a Mon Sep 17 00:00:00 2001 From: Shad Ahmad Zaidi Date: Sat, 10 Nov 2018 03:17:19 +0530 Subject: [PATCH] Describing the example of creating an array (#22366) * Describing the example of creating an array Describing the example as well as syntax for creating an array * Fixed grammar and formatting issues --- guide/english/java/arrays/index.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/guide/english/java/arrays/index.md b/guide/english/java/arrays/index.md index 3ac618ee56..24a6c58e0f 100644 --- a/guide/english/java/arrays/index.md +++ b/guide/english/java/arrays/index.md @@ -37,12 +37,14 @@ Note: The style `double list[]` is not preferred as it comes from the C/C++ lang ```java dataType[] arrayName = new dataType[arraySize]; ``` +Here we have declared and initialized the array in one step. We could have also written it in two parts with one step being the declaration of array followed by the initialization of array. By default, all memory locations allocated to the array is initialized to its default values, depending upon the datatype. ## Code snippets of the above syntax: ```java double[] List = new double[10]; ``` + We are creating a array variable named `List` of type double and allocating it 10 memory locations. This double datatype array is initialized to `0.0` by default. ## Another way to declare and initialize an Array: