1: Keywords (master)
(1) Words that are given a specific meaning by the Java language
(2) Features:
The letters that make up the keyword words are 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: identifier (master)
(1) is a sequence of characters that give names to classes, interfaces, methods, variables, etc.
(2) Composition rules:
A: English uppercase and lowercase letters
B: Digital
C:$ and _
(3) Precautions:
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: The package is actually a folder, used to distinguish the same class name
Name of package to all lowercase
Single-level package: lowercase
Example: liuyi,com
Multi-level package: lowercase, and separated by.
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: Start 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) Notes are important
Annotations are a good programming habit that a programmer must have
Beginners to write a program can develop habits, write comments before writing code
Put your thoughts through the comments first, and then use the code to reflect
The code should be just a form of reflection of thought.
(1) The text that explains the program
(2) Classification:
A: Single-line comment//
B: Multiline Comment/**/
C: Documentation Comments (later)/** */function: By Javadoc tool parsing generates a manual
(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.
Later, we will explain a more advanced debugging tool
4: Constant (Master)
(1) The amount of the value does not change during program execution
(2) Classification:
A: Literal constants
B: Custom Constants (later)
(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 (said later)
(4) provides four representations of integer constants in Java
8 bit (bit) equals one byte, and one Chinese character occupies two byte space
1 byte = 8 bit
1 KB = 1024x768 byte
1 MB = 1024x768
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: Binary conversion (Learn)
(1) Other binary to decimal
Coefficient: is the value on each bit
Cardinality: X-binary cardinality is X
Right: The data on each digit, from the right, and numbering starting from 0, the corresponding number is the right to the data.
Results: The sum of the coefficients * cardinality ^ power power.
Octal: 100 Target: Decimal
100 (octal) = 1*8^2+0*8^1+0*8^0=64 (decimal)
(2) Decimal to other binary
In addition to the base fetch, the remainder is reversed until the quotient is 0.
(3) Fast conversion method of the binary conversion
A: Conversion between decimal and binary
8421 yards.
B: Binary to octal, hexadecimal conversion
(4) Signed data representation in a computer, there are 3 symbols of the number of representations: The original code, anti-code and complement.
All data is performed in the complement.
The original code is the binary fixed-point notation, that is, the highest bit is the sign bit, "0" means positive, "1" is negative, and the remaining bits represent the size of the value.
The inverse code of a positive number is the same as its original code, and the inverse code of negative number is the inverse of its original code, except the sign bit.
The complement of a positive complement is the same as its original code, and the complement of a negative number is the minus 1 of its inverse code.
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 a corresponding data type for each kind of data.
(2) Category:
A: Basic Data Type: 4 Class 8 kinds of
B: Reference data type: Class, interface, array.
(3) Basic data Type
A: integer consumption of bytes
byte 1 bytes
Short  2 byte
int 4 bytes
Long 8 bytes
B: Floating point
float 4 bytes
Double 8 byte
C: Character
Char 2 bytes
D: Boolean
Boolean 1 bytes
Note: The
integer defaults to the int type, and the floating-point number is double by default. The
Long Integer is added to 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);
(4) Study Questions and interview questions:
A: Are there any differences in 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: What is the result of the following operation?
byte B = (byte) 130;
D: Character participation operation
is to find the value inside the ASCII
' A ' 97
' A ' 65
' 0 ' 48
System.out.println (' a ');
System.out.println (' a ' + 1);
E: String participation operation
This is actually a string connection.
System.out.println ("Hello" + ' a ' + 1);
System.out.println (' A ' +1+ "Hello");
System.out.println ("5+5=" +5+5);
System.out.println (5+5+ "=5+5");
JAVA_DAY02 (on Java basis)