Recently hoped to consolidate the foundation, looked Li Xinghua teacher's "Java Core technology explaining" a book, along with the study process record some scattered small knowledge points, facilitates later remembers .
If there are errors and suggestions, please note.
Keywords in 1.Java
| Abstract |
Assert |
Boolean |
Break |
Byte |
Case |
Catch |
| Char |
Class |
Continue |
Const |
Default |
Do |
Double |
| Else |
Extends |
Enum |
Final |
Finally |
Float |
For |
| Goto |
If |
Implements |
Import |
instanceof |
Int |
Interface |
| Long |
Native |
New |
Package |
Private |
Protected |
Public |
| Return |
Short |
Static |
Synchronized |
Super |
Strictfp |
This |
| Throw |
Throws |
Transient |
Try |
void |
Volatile |
While |
(1) Goto (unconditional jump), const (solid definition) does not have any meaning in Java, but also is the keyword, but belongs to the unused keyword.
(2) Ture, false, NULL, strictly speaking is not a keyword , but does have a special meaning of the identity.
(3) The Assert is JDK1.4 added, and the enum is added after the JDK1.5.
Size, range, and default values for 2.Java base data types
| No. |
Data type |
Size/bit |
Range of data that can be represented |
Default value |
| 1 |
Byte (bytes) |
8 |
-128~127 |
0 |
| 2 |
Short (shorter integer type) |
16 |
-32768~32767 |
0 |
| 3 |
int (integral type) |
32 |
-2147483648~2147483647 |
0 |
| 4 |
Long (integer) |
64 |
-9223372036854775808~9223372036854775807 |
0 |
| 5 |
Float (single precision) |
32 |
-3.4E38 ~ 3.4E38 |
0.0 |
| 6 |
Double (dual precision) |
64 |
-1.7E308 ~ 1.7E308 |
0.0 |
| 7 |
char (character) |
16 |
0~255 |
' \u0000 ' |
| 8 |
Boolean (Boolean) |
-- |
True or False |
False |
(1) integers are defined by default to int, such as 10 by default to type int constants.
(2) the strength of a small tree is set to double by default.
(3) Long: used when the date time or file length is indicated.
(4) Byte: This type is used when transmitting data.
(5) Boolean: Used for logical operation of the program.
(6) The default value does not work for the method and can only work when the class property is defined.
3. Transformation of data operations
(1) Auto Transition ( small to large ):-----------------------
(2) Forced transformation ( from big to small ): double--------------and---
(3) about int and char conversions: Uppercase range: 65~90, lowercase letter range: 97~122, 32 difference between uppercase and lowercase letters
4.Java uses Unicode encoding instead of ASCII encoding
Unicode encoding is a code that uses hexadecimal definitions to represent arbitrary text, including Chinese (1 char accounts for 16 bytes).
5. In many languages, Boolean is also expressed as 0 or nonzero, but only true and false in Java.
6. Commonly used escape characters
| No. |
Escape character |
Describe |
| 1 |
\f |
Page change |
| 2 |
\b |
Backwards One |
| 3 |
\ r |
Return to position |
| 4 |
\ t |
TAB tab |
| 5 |
\\ |
Reverse Slash |
| 6 |
\‘ |
Single quotation marks |
| 7 |
\‘‘ |
Double quotes |
| 8 |
\ n |
Line break |
7. Any data type "+" operation that encounters a string variable will automatically program the string type
Example: String type + int type + Double type = string
8. About & |
(1) on the logical operation:
&: Mean and , all the judging conditions should be executed in turn;
&&: Indicates a short-circuit with , a number of conditions, if the previous condition returned false, then no longer judge , the result is false;
|: Normal or , all judgment conditions should be executed in turn;
|| : Indicates a short-circuit or , a number of conditions, if the previous condition returns True, the following is no longer judged , the result is true;
(2) Bitwise arithmetic:
& represents bits and operations, | Represents a bit or operation.
9.switch Supported judgment values
(1) Jdk1.0~jdk1.4:switch supports integer and character judgments;
(2) Jdk1.5~jdk1.6:switch supports the judgment of the newly added enumeration (enum) data;
(3) Jdk1.7:switch supports the judgment of string data;
Summary: The argument passed to switch can only be an integer expression or a string, and a long cannot be used.
10.system.out.println () also belongs to method overloads.
Java Basics Trivia (supplemented with learning)