Java Development Environment Building
1. Download JDK
2. Environment variable Configuration
3. Enter Java-version in DOS
Java Run process
Source file: Write source file, suffix. java
Compile: Compile the source file into a bytecode file with a. class suffix.
Run: Run a bytecode file with the interpreter
The first Java program
Output Hello world!
Public class Hello { publicstaticvoid main (string[] args) { System.out.println ( "Hello world!" ); }}
Output:
Key words
Identifier
1, can only be composed of numbers, letters, $, _
2. Cannot start with a number, first letter, case-sensitive
Data types and Constants
Constants: The amount of unchanging data
5: Integer Constants
True: Boolean Constants
5, 5: floating-point constants
S: Character constants
Binary, octal, decimal, hexadecimal
Binary: Digital start plus 0B
Octal: Number start plus 0
Decimal: No need to add
Hex: Number starts with 0X
Comments
Single-line Comment://
Multiline Comment:/* */
Document Comment:/**/
Java Review (i)