Java has two type system:
Every object contains a single value of the corresponding primitive type.
Autoboxing: a process of converting a primitive type to a reference one.
Reference type takes much memory than primitives.
The performance of a Java code is quite a subtle issue, it depends on:
it is better to use primitive type than Reference type because it is much faster and takes less memory.
Exception is an event that occurs during the execution of a program that disrupts the normal flow of instructions. When an error occurs within a method, the method creates an object and hands it off to the runtime system. The object, called an exception object, contains information about the error, including its type and the state of the program when the error occurred. Creating an exception object and handing it to the runtime system is called throwing an exception.
Valid Java programming language code must honor the Catch or Specify Requirement.
Objects of type Scanner are useful for breaking down formatted input into tokens and translating individual tokens according to their data type.