—————— Android Training, Java training, look forward to communicating with you! —————— A java keyword keyword is a word that is predefined in a programming language and gives a special meaning, also known as a reserved word.
Key Words |
Description |
Abstract |
Abstract methods, modifiers for abstract classes |
Assert |
Whether the assertion condition satisfies |
Boolean |
Boolean Data types |
Break |
Jump out of a loop or label code snippet |
Byte |
8-bit Signed data types |
Case |
A condition for a switch statement |
Catch |
Match with try and catch exception information |
Char |
16-bit Unicode character data type |
Class |
Defining classes |
Const |
Not used |
Continue |
Do not execute the remainder of the loop body |
Default |
Default branch in the switch statement |
Do |
Loop statement, the loop body is executed at least once |
Double |
64-bit double-precision floating-point number |
Else |
The branch that executes when the IF condition is not established |
Enum |
Enum type |
Extends |
Represents a class that is a subclass of another class |
Final |
Indicates that a value cannot be changed after initialization Indicates that a method cannot be overridden, or that a class cannot have subclasses |
Finally |
In order to complete the execution of the code design, mainly for the robustness and integrity of the program, regardless of whether there is no exception to execute code. |
Float |
32-bit single-precision floating-point number |
For |
For Loop statement |
Goto |
Not used |
If |
Conditional statements |
Implements |
Indicates that a class implements an interface |
Import |
Import class |
instanceof |
To test whether an object is an instance of a class |
Int |
32-bit integer number |
Interface |
interface, an abstract type, with only the definition of methods and constants |
Long |
64-bit integer number |
Native |
Represents methods implemented in non-Java code |
New |
Assigning a new class instance |
Package |
A series of related classes make up a package |
Private |
Represents a private field, or method, etc., accessible only from within the class |
Protected |
Indicates that a field can only be accessed through a class or its subclasses Subclasses or other classes within the same package |
Public |
Represents a shared property or method |
Return |
Method return value |
Short |
16-digit number |
Static |
Represents a class-level definition that is shared by all instances of the |
Strictfp |
Floating-point comparisons use strict rules |
Super |
Represents a base class |
Switch |
SELECT statement |
Synchronized |
A block of code that represents a single thread that can be accessed at the same time |
This |
Represents the invocation of the current instance or call another constructor |
Throw |
Throw exception |
Throws |
Defining exceptions that a method might throw |
Transient |
Modify fields that do not serialize |
Try |
Represents a code block to do exception handling or a finally mate to indicate whether throwing an exception executes the code in the finally |
void |
Tag method does not return any values |
Volatile |
Tag fields may be accessed by multiple threads at the same time without synchronizing |
While |
While loop |
Two identifier identifiers can be understood as a name, which is used to identify the package name, class name, method name, parameter name, variable name, and so on; there are strict naming conventions for Java identifiers: 1. All identifiers should start with a letter (A-Z or a-Z), a dollar sign ($), or an underscore (_).
2. The first character can be a combination of any character
3. Keywords cannot be used as identifiers
4. Identifiers are case-sensitive
Examples of legal identifiers: Age, $salary, _value, __1_value
Examples of illegal identifiers: 123abc,-salary to make the code more normalized, it is recommended that you follow these naming conventions: 1. All letters are lowercase, for example: Com.java.one. 2. Class name and interface name each word should be capitalized, for example: Arraylist, Iterator. 3. Constant name All letters are capitalized, the words are underlined, for example: Kay_one_honm. 4. The first letter of the variable name and method name is lowercase, beginning with the first letter of each word from the second word, for example: LineNumber. 5. In the program, you should try to use meaningful words to define identifiers to facilitate the program to read, for example: UserName represents the user name. Some of the escaped characters supported in the three Java languages
symbols |
character meaning |
\ n |
Line Break (0x0a) |
\ r |
Enter (0x0d) |
\f |
Page Break (0x0c) |
\b |
BACKSPACE (0x08) |
\s |
Space (0x20) |
\ t |
Tabs |
\" |
Double quotes |
\‘ |
Single quotation marks |
\\ |
Back slash |
\ddd |
octal character (DDD) |
\uxxxx |
16 Binary Unicode characters (xxxx)
|
Dark Horse Programmer--java Foundation--Basic knowledge (I.)