ARRAYS

An array is a group of like-typed variables that are referred to by a common name.Arrays in Java work differently than they do in C/C++. Following are some important point about Java arrays.These are Homogeneous.
How arrays are stored in memory:

Reference copy:
Java creates a copy of references and pass it to method, but they still point to same memory reference. Mean if set some other object to reference passed inside method, the object from calling method as well its reference will remain unaffected.

Array Syntax:
int intArray[];    //declaring array
intArray = new int[20];  // allocating memory to array
OR
int[] intArray = new int[20]; // combining both statements in one
Arrays can be 2-D, 3-D upto N-D.
N-D array is collection of  N-1 arrays.

Comments

Popular posts from this blog

Flutter : Introduction

Dart: Functions

Firebase Cloud Messaging