Java Reference
In-Depth Information
Grades 1:
Mean of all grades is 74
Min grade is 48
Max grade is 92
Grades 2:
Mean of all grades is 80
Min grade is 57
Max grade is 99
Grades 3:
Mean of all grades is 84
Min grade is 55
Max grade is 100
isArray: true
getClass: [I
getSuperclass: class java.lang.Object
getComponentType: int
Arrays.toString: [55, 70, 82, 89, 97, 98, 100]
How It Works
The Java array type is often dismissed for its insuperiority to Java's more sophistic-
ated ArrayList (part of the Java Collections Framework). Often this criticism comes
from the inflexibility of the array type. Java arrays hold a fixed amount of data. That
is, when an array is created, you must specify how much data it can hold. Once an ar-
ray has been created, you cannot insert or remove array items or otherwise change the
size of the array. However, if you have a fixed amount (and especially a very large
amount) of data that you just need to work on while iterating over it sequentially, an ar-
ray may be a good choice.
The first thing you need to know about the Java array type is that it is an Ob-
ject type. All arrays, regardless of the type of data they contain, have Object as
their superclass. The elements of an array may be of any type, as long as all elements
are of the same type either primitive or object reference. Regardless of the array type,
the memory for an array is always allocated out of the heap space for the application.
The heap is the area of memory used by the JVM for dynamic memory allocation.
Search WWH ::




Custom Search