------Java Training, Android training, iOS training,. NET training, look forward to communicating with you! -------
1.Java keywords: words that are given special meaning by the Java language, all letters in the keyword are lowercase
Keyword defining the data type: class interface byte short int long float double char boolean void
Keyword that defines the data type value: True false null
Define the keyword for Process control: If else switch case default and do for break continue return
Keywords that define access modifiers: private protected public
Keywords defining classes, functions, variable modifiers: abstract final static synchronized
Keywords that define the relationship between classes and classes: extends implements
Define a keyword to create an instance, reference an instance, and judge an instance: new This super instanceof
Keywords for exception handling: Try Catch finally throw throws
Keywords for packages: Package Import
Other modifier keywords: native strictfp transient volatile assert
The 2.Java identifier consists of $ _ number 0-9, 26 alphanumeric characters, and the number can not begin
Name specification:
Package name: All letters lowercase when multiple words are composed
Class name, Interface name: When multiple words are composed, the first letter of all words is capitalized
Variable name, function name: When multiple words are composed, the first letter is lowercase, the second word starts, the first letter of each word is capitalized
Constant name: All uppercase letters, words directly underlined connection
3. Note: Text used to annotate the explanatory program
Format: Single line comment//Multiline Comment/* * * Document Comment/** */
Single-line comments and multiline comments are not interpreted by the JVM, and the document comments are Java-specific annotations that can be parsed by the tool Javadoc provided by the JDK to produce a set of explanatory documents as Web pages
4. Data type
Base data Type: Boolean (Boolean) character type (char) numeric
Numeric type is divided into integers (byte short int long) decimal type (float double)
integer default int decimal number default double assign float to add F, such as float num=2.324f; Long tt=888l;
Reference data type: Classes (Class) interface (interface) array ([])
Char in Java has 2 bytes that can be given to Chinese characters
5. + can connect on behalf of the string. strings and any data using + are connected and eventually become strings.
6. Escape character: Change the meaning of a symbol or letter by \
7. The difference between + = and = +: short s = 4; s = s + 5; Compile failed, S will be promoted to int, 4 bytes
s + = 5; Do not error, only assignment operation, will automatically convert
8. The result of the comparison operator is Boolean, true, False
9. Logical operators in Java are used to concatenate Boolean expressions:
With (&), or (|), XOR (^) non (!) and (&&), or (| | )
^ true = False when both sides are not the same
& && Difference: When the left side is false,,&& omit the right operation, the efficiency is slightly higher & both sides of the operation,
10. Bitwise operator << left shift >> right shift >>> unsigned right shift
& and | or ^ Xor ~ Anti-code
A number of different or the same number 2 times, the result is unchanged. Application: n = n^m; m = m^n; n = n^m; Can be clever n, M interchange
A. Switch statement expression recognizes only 4 types of byte short int char
A case without a match executes the default
12. The simplest form of expression for the infinite loop for (;;) {} while (true) {}
In Java, a function is a separate applet defined in a class that has a specific function
Functions are also called methods
function can only be called in functions, cannot be defined in function
------Java Training, Android training, iOS training,. NET training, look forward to communicating with you! -------
Java Basics Section Notes