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 exist as reserved words.
B: High-level notebooks like notepad++ have special color tags on keywords
2: Identifiers (Master)
(1) is a sequence of characters that give names to classes, interfaces, methods, variables, etc.
(2) Constituent rules:
A: English case letters
B: Numbers
c:$ and _
(3) Note:
A: Cannot start with a number
B: cannot be a keyword in Java
C: case-sensitive
(4) Common naming conventions (see Name and meaning)
A: Package All lowercase
Single-level pack: lowercase
Example: liuyi,com
Multi-level package: lowercase, and separated by.
Example: Cn.itcast,com.baidu
B: Class or interface
A word: Capitalize the first letter
Example : Student,demo
Multiple words: Capitalize each word
Example: Helloworld,studentname
C: Method or Variable
A word: lowercase first letter
Example: Name,main
Multiple words: Start with a second word, capitalize 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 Comments (later)/** */
(3) wrote a annotated version of the HelloWorld case.
We're going to write a procedure in the back.
Demand:
Analysis:
Realize:
The code reflects:
(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) The amount of the value does not change during program execution
(2) Classification:
A: Literal constants
B: Custom Constants (actually the amount that is modified by the final keyword)
(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 representations of integer constants in Java
A: Binary consists of 0, 1. Start with 0b.
B: Octal system by 0, 1, ... 7 composition. Start with 0.
C: Decimal by 0, 1, ... 9 composition. Integers are decimal by default.
D: Hex by 0, 1, ... 9,a,b,c,d,e,f (both uppercase and lowercase) are composed. Start with 0x.
5. Overview of the binary and its conversion
6. Symbolic representation of data
7: Data type (master)
(1) Java is a strongly typed language that provides the corresponding data types for each type of data.
(2) Classification:
A: Basic Data type: 4 classes of 8
B: Reference data type: Class, interface, array.
(3) Basic data types
A: integer consumption of bytes
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.
Long integers to be added L or L.
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 conversion
A: From small to large
B:byte,short,char--INT--long--float--double
C:byte,short,char do not convert each other, directly into the 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);
9.ASCII Code Table
' A ' 97
' A ' 65
' 0 ' 48
Javase: Naming rules, binary conversions, original code-complement anti-code, data types, and conversions