Java base identifier

Identifier: the name of the class, method or variable defined by the programmer. The identifier consists of capital letters, numbers, Underline () and dollar sign, but cannot start with a number. In the Java language, case is strictly sensitive. Package name: use lowercase letters. Class name and interface name: usually defined as words with meaning, and the first letter of all words is capitalized. Method name: usually also composed of words with meaning, the first word The first letter is lowercase, and the first letters of other words are capitalized. Variable name: member variables and methods are the same, and all local variables are in lowercase. Constant name: all use uppercase, and the last word has been separated with underscore. Keyword: 1 Access modifier keyword. Public: the modified classes, methods and variables are public. Other classes can access the classes, methods or variables modified by this keyword. Protected: used to modify methods and variables that can be accessed by classes or subclasses in the same package. Private: it also modifies methods and variables. Methods and variables can only be accessed by their class. 2. Class, method and variable modifier keywords. Class: tell the system that the word behind is a class name, which is the top class name. Interface: tell the system that the following word is an interface name, so as to define an interface. Implements: let the class implement the interface. Extensions: used for inheritance. Abstract: Abstract modifier. New: instantiate the object. 3. Process control keywords process control statements include if else switch case default, for do while, break, continue, turn instanceof keywords, which are used to judge whether an object is an instance of a class or interface. 4. Exception handling keywords the basic structure of exception handling is try catch finally. These three words are keywords. Exception handling also includes throw and throws. The assert keyword is used in the assertion operation, which is also regarded as exception handling. 5. Package control keyword there are only two package control keywords, namely import and package. The inport keyword is used to import packages or classes into the program; The package keyword is used to define the package and define classes into the package. 6. There are 8 basic data types for data type keywords, Boolean, char, char (byte) external numeric type, divided into short int long and short double. 7. Special type and method keywords. Super keyword is used to reference the parent class, and this keyword is used to apply the current class object. Void keyword is used to define a general method, which has no return value. 8. There are no used keywords. There are two alternatives in the keyword family, const And goto know that keywords are words used in the system, but although these two classes are keywords, they are not used in the system. All keywords are lowercase. If uppercase is used, it must not be a keyword. Comments: single line comments: (/ /) multiline comments: (/ /) document comments (/ * /)

Integer type: the integer type can be divided into four types according to the number of bits in the occupied memory space: byte (byte) bits 8, value range - 2 (7) - 2 (7) - 1 short (integer) bits 16, value range - 2 (15) - 2 (15) - 1 int (integer) bits 32, value range - 2 (31) - 2 (31) - 1 long (integer) bits 34, value range - 2 (63) - 2 (63) -1 floating point type: the floating point type is divided into single precision floating point type: bit: 32 value range 1.4e-45 ~ 3.4e + 38 double precision floating point type: bit: 64 value range 4.9e-325 ~ 1.7e + 308. The default is double precision floating point type. When single precision floating point type is used, The value must be followed by f or F. in double precision floating-point types, D or D can be used as a suffix. Character type the data type used to store characters. It can be defined directly or using Unicode encoding. Partial translator in Java \ 'single quotation mark \ "double quotation mark \ \ slash \ r enter \ N line feed \ f page feed \ t skip \ B backspace

          >   >=   <   <=           ==   !=           &           ^           |           &&

          ||           ? : = + = - = * = lowest priority

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>