October 2017
Beginner
318 pages
7h 26m
English
Let's begin by taking a look at the syntax behind declaring and initializing an array in Java. The following line of code will cause an array to come into being with enough space to hold seven characters:
char[] arrayVar = new char[7];
To the left of our assignment operator (=), the syntax looks pretty familiar, not unlike the syntax we would use when declaring any other primitive or object. We begin by telling Java what type of element we're going to declare here. In this case, we're declaring a character array. The empty square brackets lets Java know that rather than creating a single character variable, we'd like to declare an array type variable because our array is a variable just like any other. ...
Read now
Unlock full access