Java Grammar Learning Overview

Source: Internet
Author: User
Tags bitwise constant definition logical operators

Java Grammar Learning Overview:

1, the numerical types are:
Integer type sub -
byte:127 to 128 8 bits (1 bytes); Use only the latter seven digits to represent the first digit table of numbers
The most basic data unit, occupying less space

Short:16 bit (2 bytes) Short integer-32768 to 32767

Int:32 bits (4 bytes) integer plus or minus 2.1 billion write programs mostly in int

long:64 bit (8 bytes) Long integer +-922 16 0 +
Numbers followed by the letter L or lowercase l indicate long data
When you use a number to represent time, you start with a long type and now every
The seconds are increasing.
floating Point Type
Float:32 bit (4 bytes) Single-precision floating-point type
After the data, add F or F to indicate
A description with no F representation is a double type
double:64 bit (8 bytes) Double-precision floating-point type
The default type for decimals can be represented by a number plus D or D.
2, character type: Char
Assignment single quote ', smart with one character
Shaping numbers, representing the encoding and location of characters
Escape character starts with \ \ n line break \ r enter \ t tab
\ \ output back slash \
3, Boolean type: Boolean
True logic True
False logic False
③ variables and Constants
Variable definition mode: Data type variable name;
Data type variable name = value (or defined variable);
Rule: Naming must conform to identifier naming rules
Name do not repeat
Naming makes sense to be easy to understand and read
Constant definition Mode: Final data type constant name;
Final data type constant name = value;
Rule: Only one time can be assigned
Name General ALL Caps

Scope: member variable (global variable), valid for the entire class. defined in the class and method
Between the first curly brace and the second curly brace.
Local variables, defined in the method, in the second curly brace, only in the method.
Effect.

1, assignment operator: Implement right-to-left assignment, symbol =
2, arithmetic operator: symbol +-*/% (for redundancy or modulo), the result automatically turns into the largest
Type, automatic upgrade.
3, comparison operator: symbol < <= > >= = = (equality)! = (Not equal)
Returns a Boolean type Boolean with only two cases of true false
4, self-increment decrement operator: symbol + +--Assign value before priority is high first + = = *=/=
5, logical operators: Logic and & && (&& short circuit notation) must all be true before returning true
As long as there is a false, the result must be false
Logical OR | | | (| | Short-circuit notation)
As long as one is true, the result is true
Must all be false, is false
Logical Non! Reversing effect


6, bitwise operator: Cardinality is 2, left shift from 0 to +∞ ascending right shift from 0 to-∞ power down
7, ternary operator: logical expression? : What is the result of the logical operation? Back: Splitting effect
8, Priority:

① parentheses () highest precedence
② plus sign +-
③ unary operator + + +--!
④ multiplication */%
⑤ plus minus +-
⑥ shift operators >> >>> <<
⑦ Compare Size < > >= <=
⑧ comparison is equal = = =
⑨ Transposition and Arithmetic &
⑩ Bitwise XOR OR Operation ^
⑾ Bitwise OR Operation |
⑿ Logic and Operations &&
⒀ logic or Operations | |
⒁ ternary operator? :
⒂ Assignment operator = Lowest

① identifiers include : Package name, class name, method name, variable name, constant name, property name
Identifier writing rules: 1, identifiers consist of letters, numbers, _, and $
2, the number cannot be in the starting position
3, cannot repeat with keywords and reserved words
4, Case sensitive
② basic data types include: numeric, character, Boolean

Java Grammar Learning Overview

Related Article

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.