Java Basics Summary-variables, operators summary

Source: Internet
Author: User

Basic Overview of---variables----
Variable: It is used to store data
Declaration of variables: variable type variable name, variable type---distinguish different types of data, variable name--access variable by name
Variable name (rule): see the meaning of the name, the first letter lowercase after the hump rule
Scope of the variable: within the method/local code block
Variable initialization: The general condition is initialized (the member variable JVM initializes the default)
Classification of---Variables---(java because the JVM exists cross-platform, so the data of various data types occupy the same storage space)
1. Underlying data types
Integral type: byte-1b short-2b char-2b int-4b long-8b
Boolean: Boolean---True/false
Float type: folat-4b double-8b (Precision is distinguished)
2. Reference data types
String (there is a string constant pool if the content is the same as the same string) array of references to various objects--actually storing the address pointing to the object
NOTE: eg int x = 5; At this point 5 is the literal value, the integer default-int floating point number default-double
1. Assigning a small range of values directly to a large range will not compile errors
2. A compilation error occurs when assigning a large range to a small range
3. If you must assign a large range to a small range-mandatory type conversions must be used
A type variable name = (Type a) value;-When the value is changed, the value of the high is discarded to show the low data directly.
The memory allocation process for---variables---
Underlying data type-direct allocation (can be used to determine the size of memory consumed at compile time)--only one piece of memory
Reference data Type--dynamic allocation (unable to determine the size of the occupied memory at compile time)--two blocks of memory (storage object address + object entity)
Underlying data type--stores the value of the variable itself, the reference data type---the address of the object to which it is stored
---operator----
1. Arithmetic operators
2. Logical operators
3. Comparison operators
4. Bitwise operators
6. Operators
7. Three mesh operator

Java Basics Summary-variables, operators summary

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.