1: keywords (master)
(1) words that are given a specific meaning by the Java language
(2) features: All lowercase
(3) precautions:
A:goto and const as reserved self-existence
B: high-level notebooks like notepad++ have special color tags on keywords
2: identifier (master)
(1) is a sequence of characters that give names to classes, excuses, methods, variables, etc.
(2) composition Rules:
A: Chinese and lowercase letters
B: Letters
C:$ and _
(3) precautions
A: cannot start with a number
B: cannot be a keyword in Java
C: Case Sensitive
(4) Common Naming conventions
A: Package All lowercase
Single-level package: Lowercase. Example: cn.itcast, Com.baidu
B: class or interface
One word: capitalize the first letter. Example: Student,demo
Multiple Words: capitalize the first letter of each Word. Example: Helloworld,studentname
C: method or variable
One word: first letter Lowercase. Example: Name,main
Multiple words: starting with the second word, capitalize the first letter of each Word. Example: Studentage,showallnames ()
D: constant
All caps
One word: Uppercase. Example: PI
Multiple words: uppercase and separated by _. Example: Student_max_age
3: Note (master)
(1) the text that explains the program
(2) classification:
A: Single-line comment://
B: Multiline comment:/**/
C: Documentation note:/** */
(3) wrote a annotated version of the HelloWorld Case.
The process of writing a program:
Implementation---code
(4) the role of annotations
A: explain the procedure, improve the reading of the Code
B: can help us debug the program
4: constant (master)
(1) in the process of program execution, the amount of its value does not change is called constant
(2) classification:
A: Literal constants
B: Custom Constants
(3) Literal constants
A: string constant "Hello"
B: Integer constant 12,23
C: Decimal Constant 12.345
D: character constant ' a ', ' a ', ' 0 ',
E: Boolean constant True False
F: Empty constant null
(4) provides four-way representation in Java for integer constants
A: binary consists of 0, 1, starting with 0b
B: octal system by 0, 1, ... 7 Composition. Starting from 0
C: decimal by 0, 1, ... 9 Composition. Integers are decimal by default
D: Hexadecimal by 0,1,... 9,a,b,c,d,e,f (alphabetic case can be) Composed. Start with 0x
5: Binary Conversion (learn)
(1) other binary to decimal
Coefficients: data on each bit
Cardinality: X-binary Cardinality is X
Right: the data on each digit starts from the right and is numbered starting at 0, and the corresponding number is the right
Results: the sum of the coefficients * cardinality ^ power Power.
(2) Decimal to other binary
In addition to the base take-up, know quotient is 0, remainder reversal
(3) Fast Conversion method of the binary conversion
A: Conversion between decimal and binary
8421 YARDS.
B: binary to octal, hexadecimal conversion
6: variable (master)
(1) The amount of the value that can change within a certain range during the execution of a program
(2) define the format of the Variable:
A: data type variable name = initialization value;
B: Data type variable name;
Variable name = initialization value;
7: Data Type (master)
(1) Java is a strongly typed language that provides the corresponding data types for each type of Data.
(2) classification:
Basic Data type: 4 classes of 8
Reference number type: class, interface, array.
(3) Basic data types
A: integer: the number of bytes occupied
BYTE 1
Short 2
int 4
Long 8
B: floating Point
Float 4
Double 8
C: character
Char 2
D: Boolean
Boolean 1
Attention:
integers are type int by default, and floating-point numbers are double by default
L or L are to be added to the long integer type.
Single-precision floating-point numbers are added F or F.
8: Data type conversion (mastering)
(1) Boolean type does not participate in conversions
(2) Default (implicit) Conversion
A: from small to large
B:byte,short,char--int--long--float--doubel
The C:byte,short,char does not convert from one to the other, directly into INT type participates in the operation
(3) Forced conversion
A: from big to small
B: there may be a loss of precision, generally not recommended for such use.
C: format
Target data type variable name = (target data Type) (converted data);
(4) Study Questions and facial questions
A: Is there a difference between the following two ways?
Float F1 = 12.345f;
float F2 = (float) 12.345;
B: is there a problem with the program below, and if so, where?
BYTE B1 = 3;
byte B2 = 4;
byte B3 = b1+b2;
byte B4 = 3+4;
C:byte B = 130; is there a problem? What do you do if you want to make the assignment correct? How much is the result?
D: Character participation operation
is to find the value inside the ASCII
' A ', ' a ', ' 0 '
E: String Participation operation
Here is actually a link to the string
Javase Study Notes 1