11 lines
1.2 KiB
JSON
11 lines
1.2 KiB
JSON
{
|
|
"title" : "Arrays and Strings",
|
|
"slug" : "arrays-and-strings",
|
|
"content": [
|
|
{"data":"## Arrays and String"},
|
|
{"data":"An array is a collection of similar type of elements that are stored in a contiguous memory location. Arrays can contain primitives(int, char, etc) as well as object(non-primitives) references of a class depending upon the definition of the array. In the case of primitive data type, the actual values are stored in contiguous memory locations whereas in the case of objects of a class the actual objects are stored in the heap segment. In Java, all the arrays are allocated dynamically. The size of an array must be specified by an int value and not long or short. The array index starts from 0 and goes up to n-1 where n is the length of the array."},
|
|
{"data":"#### Array Declaration Syntax"},
|
|
{"data": "An array declaration has two components: the type and the var-name. The type declares the element type of the array. The element type determines the data type of each element that comprises the array. The var-name declares the name of the array variable. Like an array of int type, we can also create an array of other primitive data types like char, float, double…etc."}
|
|
]
|
|
}
|