Uninstallation and installation of JDK:
1 uninstalling
A remove the control panel from the program-programs and features-uninstall the JDK;
b Remove C:\Windows\System32 below the Java javac JAVAW ...
C Remove the configuration from the environment variable
Computer-Right-click Properties-Advanced system Settings-advanced-Environment variables remove the JAVA portion of Java_home path, classpath
2 Install next ...
Note that the installation path, set up a separate folder management, folder names do not have Chinese, do not have spaces;
The installation process pops up when the JRE clicks Cancel and does not need to be installed separately
Compiled syntax: javac hello.java javac source file includes extension
Run syntax: Java Hello Java bytecode file name, do not extend the name
Environment variables: java_home = root directory of JDK E:\java\jdk1.7
Path =%java_home%\bin
Why you need to configure environment variables: files can be compiled and run under any directory file (no need to put the source files under the bin to run)
The cross-platform principle of Java: Different operating systems install the appropriate JVM, and different JVMs can run all Java files: one (one Java program) to many (multiple different JVMs) to many (multiple different OS) relationships
Can a class have no Main method, main?
A class that does not have the main method can be compiled through, conforms to the Java syntax specification
B A class without a Main method is not capable of running alone
The main method is the entrance to the program, and the JVM executes the code from the Main method
1 Strict case-sensitive system system is not the same in Java
The name of the 2-byte code file is the same as the class name in the source file
3 If a class uses public adornments, then the class name and source file name must be consistent
?? Can there be more than one public-decorated class in a Java file?
There can be only one public class in a source file.
A source file can have multiple non-public classes.
41 Java source files can write multiple classes, but it is recommended that a file write a class
Comments in Java:
1//single-line comment Note One line is based on the row delimiter
2/* * * Multi-line comment, can comment on multiple lines
3/** * * Document comments, you can also comment on multiple lines, you can use the Javadoc command to create a document in the document comments
A note is written to the programmer, but it is useless after compiling.
b Multi-line comments and document annotations cannot be nested with each other
Keywords in Java-reserved words-identifiers
Keywords: In fact, in the design of the Java language when the definition of some of the special meaning of the word, for example, class means declaring a class
All are lowercase, learn to remember one
Reserved words: Now there is no special meaning, the development of Java may be used after the Goto and const
Identifiers: For example, we design class name Method name Variable name these things are identifiers
Naming conventions for identifiers:
A can consist of a numeric case letter _ $, but the number cannot begin
In fact, our Chinese and Japanese is also possible, but not recommended
B Can not use keywords and reserved words in Java as identifiers such as class class{} error notation
C does not recommend using a class name that already exists in Java as its own
Class Name: Capitalize the first letter, if there are multiple words, the first letter of each word is capitalized
Method Name: First letter lowercase, if there are multiple words, the first letter of the following words are capitalized
Variable name: First Letter Lowercase
variables (very important)
Think of a variable as a variable box (container) that can store a single data (constant)
Suppose now another data 19 needs to be stored with a variable box.
① must have a variable---> variable declaration (definition)
Format: Data type variable name;
② load the data values---"Assigning values to variables using an assignment symbol such as =
A first declaration after the assignment value:
int age;
age = 19; Used to add a space on each side of the =
Assign a value immediately when declaring B
int age = 19;
③ Remove the value using
A direct print
b Participate in the operation
Classification of variables: a location for the installation statement to differentiate
A local variable is declared in a method or as a parameter of a method (a variable in a pair of parentheses) and in a code block
A variable that is declared directly in a class by a member variable (all except local variables are member variables)
Scope of the variable (can be understood as a variable accessible range)
A local variable can only be accessed by this part of the declaration (for example, a method inside a declaration can only be accessed in this method)
Member variables can be accessed throughout the class
Variable name of the declared format data type variable;
Anything in Java can be seen as having its own type of data.
A basic data type * 8
Integer
BYTE 8
Short 16
int 32
Long 64
Decimal
Single Precision float 32
Double-Precision Doubles 64
Character Char 16
Boolean Boolean 1 has only two values of true false to not be able to use 1 0 to represent
Two reference data types * N
Array class interface ...
Mutual conversions between basic types
The low precision can be directly assigned to high-precision variables;
It is not possible to assign high-precision values directly to low-precision
Byte8 Short (char) int32 long64 float32 double64---> are numeric types
Why is float behind long? The storage of integers is not the same as fractional storage---"Check the information
High-precision---"low-precision forced conversion
Double d = 3.99999;
Java base 1_ identifier, data type