Rules and norms notes 004_JAVA comment keyword identifiers

summary:

1, JAVA program in the comment concept : is to make the program better able to understand, explain and explain to add!

  1. Single-line comments: // representation
  2. Multi-line comments: / ** * Content / shortcut keys: Ctrl + Shift + /

2, keyword : JAVA which has been pre-defined a special English words,

比如:public、static、class、void

3, the identifier : Some English words define our own mark. For example, the name of our HelloWorld applet

4, naming and naming conventions

  1. Hard requirement: as far as possible to begin with letters (26 letters of the alphabet can be), may comprise from 0 to 9, $, _
    1. Identifier can not begin (custom) digitally.
    2. Identifier can not be a keyword.
    3. Extracurricular added:
      variable name only alphanumeric $ _
      variable is the first character only letters $ _
      variable first character can not use digital
  2. Soft suggestion: follow the hump logo
    1. The first letter of the first name of the class as much as possible should be capitalized, the next encounter a new word must be capitalized (big camel).
    2. The method name in lowercase, then encounter a new word must be capitalized (small camel).
    3. Variables also to the first letter lowercase, then encounter a new word must be capitalized (small camel).
      Easy to understand:
    public class HelloWorld(类名称){
       	public static void main(方法名称)(String[] args){
               int i(变量名称)=5;
       		System.out.println("java,你好!");
       	}
       }

5, pay attention

  • $ Is java bytecode compiler to create a character internal use, it is recommended not to use in the source program

Guess you like

Origin blog.csdn.net/weixin_41887201/article/details/91505365