This article is selected from: IBM DW China ● MAIN method If the main (String []) method is defined, it should be written at the bottom of the class. Code write format ● Code style code should be used in UNIX, not Windows (such as: Enter the carriage return wrap). ● Documentation must use Javadoc to generate a document for class. Not only because it is standard, this is also a method recognized by various Java compilers. Using the @Author tag is not recommended because the code should not be owned by the individual. ● The indentation of indentation should be 2 spaces per row. Do not save Tab characters in your source file. Tab characters will extend to different widths due to different source code management tools. If you use Ultredit as your Java source editor, you can prohibit saving Tab characters by using Ultredit, using the length of the length of the tab used in the ULTREDIT, then use the Format | Tabs to Spaces menu Convert TAB to spaces. ● The page width page should be set to 80 characters. Sourcecodes generally do not exceed this width and causing unable to display, but this setting can also be flexible. In any case, the long statement should be folded after a comma or an operator. After a statement is folded, 2 characters should be retracted more than the original statement. ● {} The statement in {} should be used as a row. For example, the first line below is the wrong line 2 is correct: if (i> 0) {i }; // error, {and} in the same row IF (i> 0) {i } ; / / Correct, {alone as a row} statement is always separate as a line. If the} statement should be indented to the {that row relatively aligned with it. ● There should be a space between the parentheses and the latter and the latter characters. Similarly, there should be a space between the right brackets and the previous characters. The following example shows the errors of parentheses and spaces and correct use: CallProc (APARETER); // Error CallProc (APARETER); // Do not use meaningless parentheses in the statement. Brackets should only be in the source code to achieve some purpose. The following example illustrates errors and correct usage: if ((i) = 42) {// error - parentheses meaningless if (i == 42) or (j == 42) THEN // correct - indeed parentheses