Skip to Main Content
Java
book

Java

by Michael Sikora
January 2003
Beginner to intermediate content levelBeginner to intermediate
150 pages
7h 28m
English
Morgan Kaufmann
Content preview from Java
"
2.5 Data Types
1 5
will create the array intArray with two elements and initialize it with zero values, the default
value for numbers. The reason for the new keyword is that an array is actually an object in Java.
Objects in Java are created using the new keyword, as we shall see in Chapter 4.
Array elements are counted from zero, so
intArray[0] = 1;
assigns the value of 1 to the first element of
intArray.
Note that once an array is created, its
size cannot be changed.
An example of all this is the 0utputArray program, which assigns the values of 1 and 2
to an integer array and outputs the results.
OutputArray
1 public
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java Programming

Java Programming

Poornachandra Sarang
JAVA Programming

JAVA Programming

K. Rajkumar
Java Programming

Java Programming

Hari Mohan Pandey
Java 9 for Programmers

Java 9 for Programmers

Paul J. Deitel, Harvey Deitel

Publisher Resources

ISBN: 9781558609099