代码规范手册。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。Java Coding standardsThe starting point isCode Conventions for the Java TM Programming Language1 Introduction7 Stale me ts1.1 why Have Code conventions7.1 Simple statements1.2 AckINWledymenLsY, 2 Compound statements7.3 retum state ments2he Names7. 4f.if-else, if else - if else Statements2.1 File suffixes75 far statements2.2 Common file namesi.6 while statements3 Flle organization了7 do-while statements3.1 Java source files1.8 switch statements3.1.1 Beginning Commentsr, 9 trrr-catch statements3.1.2 Package and Import statements3.13 Class and interface declarations8 WhitE Srace8.1 Blank lines4 Indentation8.2 Blank Spaces4.1 Line Length4.wrapping Lines9 Namina conventions5 Comments10 Programming Practices5.1 mplementatlon comment Formats10.1 Providing Access to Instance and class variables5, 1.1 Block Comments10.2 Referring to class vanables and Methods5.1.2 Single-Line Commentsc3 Constant5.1.3 Trailing comments10.4 Vanable Assignments5. 14End-of-Line comments105 Misce aneous practices5 2 Documentation comments10.5.1 Parentheses10.5.2 Returning values6 Declarations6.1 Number per line10.5.3 Expressions before in the Conditional operator10.5.4 special Comments6.2 initialization53 Placement11 Code examp es6,4 Class and intertace declarations11.1 ava Source File fxampleNote: I recommend that you download the pdf version and use that instead of the htMl version. When Oracle bought Sun, they broke thestyle sheet of the HTML version of the language coding conventions document3C IBM CorporationJava Coding standards- The Basics-IfIf (condition)tif (condition)statementstatementC IBM CorporationJava Coding standards- The Basics-lf/elseif(condition)if (condition)Istatementsstatementsif (condition)Iif( conditionstatementsstatementsstatementselseif (condition)statementsstatementy else if (condition) Iif( conditionstatements;y else if (condition)statementsstatementselse if (condition)statementst else if( condition)tstatementsC IBM CorporationJava Coding Standards- The Basics -NamingClassesClass names should be nouns. in mixed caseclass rasterwith the first letter of each intenal word capi- cllass Imagespriteitalized. Try to keep your class names simpleand descriptive. Use whole words--avoidacronyms and abbreviations (unless the abbreviation is much more widely used than thelong form, such as URL Or HTML)lass Systemengineiclass workloadlass executeC IBM CorporationJava Coding Standards- The Basics -NamingMethodsMethods should be verbs in mixed case with run(the first letter lowercase. with the first letter of runFast(each internal word capitalizedgetBackground();Workload(iretes odeploy workload()systemEngine()iC IBM CorporationJava Coding Standards- The Basics -NamingVariablesExcept for variables, all instance, class, and intclass constants are in mixed case with a lower- charpcase first letter. Intenal words start with capi- floatmywiathtal letterVariable names should be short yet meaning.ful. The choice of a variable name should bemmemonic-that is, designed to indicate to thecasual observer the intent of its use. one-char'-acter variable names should be avoided exceptfor temporary"throwaway?" variables. Common names for temporary variables are i,1.K.m. and n for integers: c. d. and e for charactersstring argiInteger first counterObject widthC IBM CorporationJava Coding Standards- The Basics -NamingConstantsThe names of variables declared class conint MIN Width =4stants and of ansi constants should be all1nt MAX WIdTh =999uppercase with words separated by underInt GET THE CPU =1scores (").(ANSI constants should beavoided. for ease of debugging.String ISCORRECTfalseint Kylobytes =1024float constant =3.1416f:C IBM CorporationJava Coding standards- Miscellaneous Practicesif (booleanExpression)ireturn TRUEelsereturn FAlsereturn booleanExpression10C IBM Corporation