Scope of the variable
Java uses a pair of curly braces "{}" as the scope of a statement block, called a scope. Variables in the scope cannot be defined repeatedly, and the memory space allocated by the variable is withdrawn by the JVM when it leaves scope.
Wrapper classes for basic data types
Java provides the corresponding classes for the underlying data types, which are called wrapper classes.
| Types of wrapper classes |
Description |
| Byte class |
The wrapper class for the byte data type |
| Short class |
Wrapper classes for the short data type |
| Integer class |
wrapper class for INT data type |
| Long class |
Wrapper class for Long data type |
| Float class |
Packing class for float data type |
| Double class |
Wrapper class for Double data type |
| Character class |
Wrapper class for Char data type |
Boolean class
|
Wrapper classes for Boolean data types |
Some useful methods and constants are available in the wrapper class. Refer to the API for specific methods and constants. The wrapper class is also used to define the data type of the collection element in the collection
Java Language Foundation---variables and data types