The following points should be noted when writing Java programs:
- Case-sensitive: Java is case-sensitive, which means that the identifier Hello is different from hello.
- Brackets: Match any parentheses! Suggestion: The parentheses are written in pairs, and if deleted, the pairs are deleted.
- Indentation: Proper attention to the indentation of the code increases the visibility of the code.
- Symbol: When writing code, all symbols must be in the English half-width symbol input. At the same time, the end of each sentence execution code must end with a semicolon.
- Line break: Proper attention to line breaks increases the visibility of your code.
- Guide Package: You can import the corresponding tool class to assist the development.
- Class name: For all classes, the first letter of the class name should be capitalized. If the class name consists of several words, the first letter of each word should be capitalized, such as Myfirstjavaclass.
- Method Name: All method names should start with a lowercase letter. If the method name contains several words, the first letter of each subsequent word is capitalized.
- Source file name: The source file name must be the same as the class name. When saving the file, you should use the class name to save the filename (remember that Java is case-sensitive), and the suffix of the file name is. java. (a compilation error is caused if the file name and the class name are not the same).
- Main method Entry: All Java programs are executed by the public static void Main (String[]args) method.
Some points to be aware of when learning Java Basic grammar