GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Notizen

Arrays in Java

Pranjal Deshmukh Arrays Englisch 2 Seiten

Inhalt der Notizen (2)

Seite 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

Seite 2

Informationen

Beschreibung
Arrays Notiz am Arrays in Java, erstellt von Pranjal Deshmukh am 28/05/2018.
Erstellt von
Pranjal Deshmukh
Aufrufe
0
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck