Package (namespace)
Java package: it is a lowercase noun that can be separated by vertices. For example, java. AWT. event;
C # namespace: the first letter is capitalized. Generally, multiple words are combined into a class name. the first letter of each word must also be capitalized, for example, system. Data. sqlclient;
Class
Java and C # are the same: The first letter is capitalized. Generally, a class name is composed of multiple words, and the first letter of each word must be capitalized, for example, class helloworldapp;
Interface Name
Java: The naming rule is the same as the class name, for example, Interface collection.
C #: The naming rule is the same as the class name, but I must be added before, for example, icollection and iclone.
Method Name
Java: It is often composed of multiple words. The first word is usually a verb, the first letter is lowercase, and the first letter of each word in the middle must be capitalized, for example: balanceaccount,
Isbuttonpressed;
C #: Same as the class, uppercase letters are required. For example, tostring ().
Variable name:
Java and C # are the same: All lowercase letters, generally nouns, such as length;
Constant name
Java and C # are the same: constants of the basic data type are named in uppercase. If they are composed of multiple words, they can be separated by underscores (_). For example: int year, int
Week_of_month; if it is a constant of the object type, it is a mix of uppercase and lowercase, separated by uppercase letters.
Other Java:
Switch (expression ){
Case value1: statement1;
Break;
Case value2: statement2;
Break;
............
Case valuen: statemendn;
Break;
[Default: defaultstatement;]
}
◇ The return value type of expression must be int, byte, Char, and short.
◇ The value valuen In the case clause must be a constant, and the values in all case clauses should be different.
◇ The default clause is optional.
◇ The break statement is used to makeProgramExit the switch statement, that is, terminate the execution of the switch statement (in some special cases, multiple different case values need to execute the same group of operations, then you do not need to use break ).
StringOperations on strings are not performed on the Source Operation String object, but on copying a New Source Operation String object. The operation results do not affect the source string.
On the contrary,StringbufferThe connection operation on the string is performed on the source string itself. After the operation, the value of the source string changes to the connected string.