Java basics and java
1. Some simple doscommands:
-D: Switch the carriage return drive.
-Dir (directory): lists the files and folders in the current directory.
-Del: delete an object
-Md: Create a folder
-Rd: delete a folder
-Cd (change directory): change the specified directory (enter the specified directory)
- Go to the cd directory.
- Roll back cd...; cd \
-Cls: (clear screen) clear screen
-Exit: exit the doscommand line.
2. Basic data constants:
Basic data types: 4 categories, 8 Types
A: The integer occupies the number of bytes.
Byte 1
Short 2
Int 4
Long 8
B: Floating Point Number
Float 4
Double 8
C: character
Char 2
D: Boolean
Boolean 1
3. JVM, JRE, and JDK:
To put it simply:
JVM is a Java virtual machine.
JRE: Java Runtime Environment
JDK: Java Development Kit
JDK includes the runtime environment and development kit
JRE includes core class libraries and virtual machines
4. Implicit and forced conversions:
Forced conversion: Direct conversion from small to large
Example: int a = 1; byte B = 2; int c = a + B;
Implicit conversion: Small conversion is highly risky and mandatory.
Target type variable name = (target type) (converted data );
Example: byte B = 1; int I = 2; byte c = (byte) (B + I );
5. identifier:
Identifier: indicates the name of a package, class, method, or variable.
A: unicode characters
Numbers, English case and Chinese characters (Chinese characters are not recommended)
B: underline _
C: Dollar sign $
Note:
A: it cannot start with A number.
B: it cannot be a keyword in java.
Common naming rules:
A: basic requirements: click here
B: common naming rules
A: Package (actually a folder for class management), all in lower case, multi-level packages are separated.
Example: com, com. itheima
B: class. The first letter of a word is capitalized.
Example: Student, Car
Uppercase letters of each word for multiple words
Example: HelloWorld
C: Methods and variables
Lowercase letters of a word
Example: age, show ()
Multiple words start from the second word and the first letter of each word is capitalized.
Example: maxAge, getAge ()