Java Language Foundation---variables and data types

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.