Ava Environment Configuration
Java three major systems
Javase Desktop Program Development
Javame Mobile Program Development
Java EE Network Service program development
Java Environment Concepts
JDK Java Program Development environment-JRE the features needed for development
JRE Java Program Runtime Environment-JVM plus Java built-in features
JVM Java Virtual Machine, responsible for executing Java code
Configuring Environment variables
Path: Java and Javac commands can be used on any path in a DOS window
Classpath: Configuring a third-party jar
Javahome: Configure the JDK directory, third line of the program requires the Java environment to use
HelloWorld
Java Program Development Steps
1) Write Java code--"Java source code file name." Java
---"Notepad text editor
2) Compile source code--"Convert to class file"
---"Javac Java source code file name. java
3) Execute class file
---"Javaclass file name (no suffix)
HelloWorld program Templates
public class class name (same as file name) {
public static void Main (String args[]) {
Code to execute
}
}
Coding specifications
1) Reasonable indent-code is in good form
2) A line of code, ending with a semicolon
3) punctuation in English state input
4) paired programming, {},[], (), "". Write one pair at a time
HelloWorld, watch out.
1) Execution of the class when executing the procedure: Find the Main method of the class execution, from the inside of the main method from top to bottom execution
2) Java files can be written in multiple classes, only a public decorated class, and must be the same as the file name
3) Usually a Java file writes a class, so that the class is better managed.
Variable
The role of variables: in Java programs, you need to store data, pass variables
The definition of a variable:
Syntax: Data type variable name 1[= value 1], variable name 2[= value 2],...;
Assigning values to variables
Syntax: variable name = value; ----> What type of value can only be assigned to what type of variable
Use the value of the variable:
Syntax: Where a variable is used-by name of the variable
Note Points for variables:
1) variables can only be defined once
2) variable can be assigned multiple times
3) The variable definition is not assigned, and the value of the variable cannot be used.
Data type
Effect of data type: 1) constrain the range of values, better choose to use 2) Save memory
Classification of data types
1) Basic type
Digital
Integer
Byte
Short
Int
Long
Decimal (floating point)
Float
Double
Character
Boolean (logical, conditional)
2) Reference type
Java Beginner Notes Summary day1