¡GoConqr estrena diseño! Cuéntanos qué te parece.

Apuntes

Arrays in Java

Pranjal Deshmukh Arrays Inglés 2 páginas

Contenido del apunte (2)

Página 1

An array is a group of like-typed variables that are referred to by a common name.

In Java all arrays are dynamically allocated.

The direct superclass of an array type is Object.

Declaration:

int intArray[]; or int[] intArray;

When an array us declared, only a reference of array is created. To actually create or give memory to array:

var-name = new type [size];

int intArray[]; //declaring array intArray = new int[20]; // allocating memory to array

int[] intArray = new int[20]; // combining both statements in one

The elements in the array allocated by new will automatically be initialized to zero (for numeric types), false (for boolean), or null (for reference types)

Student[] arr = new Student[7]; //student is a user-defined class

Página 2

Información

Descripción
Arrays Apunte sobre Arrays in Java, creado por Pranjal Deshmukh el 28/05/2018.
Visitas
0
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?