Java has a two-fold type system :
| Type | primitives size | reference size |
|---|---|---|
| boolean | 1 bit | 128 bits |
| byte | 8 bit | 128 bit |
| short, char | 16 bit | 128 bit |
| int, float | 32 bit | 128 bit |
| long, double | 64 bit | 192 bit |

We can see either that single-element arrays of primitive types are almost always more expensive (except for long and double) than the corresponding reference type.

On the other hand, current Java language specification doesn’t allow usage of primitive types in the parametrized types (generics), in the Java collections or the Reflection API.
When our application needs collections with a big number of elements, we should consider using arrays with as more “economical” type as possible, as it’s illustrated on the plot above.
The runtime system searches the call stack for a method that contains a block of code that can handle the exception. This block of code is called an exception handler.



Objects of type Scanner are useful for breaking down formatted input into tokens and translating individual tokens according to their data type.
