Review of basic JAVA knowledge

Source: Internet
Author: User

first, the basic grammar

1. Specification of identifiers:

1) identifiers are made up of uppercase and lowercase letters, underscores, numbers, and $ symbols.
2) The beginning can be uppercase and lowercase letters, underscores, $ symbols, and can not be started with numbers.
3) There is no limit to the length of identifiers.
4) identifiers cannot be keywords and reserved words.
5) The name of the identifier is best to reflect its role
6) The Java language has strict capitalization requirements
7) All custom identifiers need to follow the naming conventions of identifiers

2.3 Types of notes:

1) Line Comment//

2) Document Comment/** */

3) Multi-line Comment/**/

3. Keywords:

Keywords or reserved words are fixed words that have special meaning to the compiler and can no longer be used for other purposes in the program.

Java's keywords have special meanings for Java compilers, and they can be used to represent a type of data data

or indicate the structure of the program. Reserved word is a Java reserved keyword, although they are not now the key

, but may be used as a keyword after you upgrade a version later

4. Constants, variables:

There is a lot of data in the program to represent the state of the program, some data will change in the process of operation, there are

Some data will not change during the program's operation. These data are called variables and constants, respectively. Variable in the

Must be declared before use: Data type variable name variables can be divided into: local variables, member variables, method parameters,

Exception handling parameters.

Local variables: Variables defined in a method are local variables that are valid only within the scope of this method, that is,

Only in this method can you use them in other methods that you cannot use.

Member variable: A member variable is declared inside a class but outside of any method or construction method. (class variable)

Method parameter: The method parameter is passed to the method or constructor method, and its scope is the method or constructor

Normal exception Handling parameters: Exception handling parameters are passed to exception handling code, whose scope is the partial constants of exception handling

is an identifier whose value is constant during operation and cannot be re-assigned. The main use of the final keyword (in J

Use the Static keyword flexibly in the Ava class to Semantic constants.

Review of basic JAVA knowledge

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.