Java+编码规范 东软编码规范,项目规范

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

D05-PDS072Java0.0.0-1.0.02004-8-20Java0.0.0-1.0.0JavaprogrammerJavadeveloperJava••••JAVAIBMJava0.0.0-1.0.02.1JavaClassOrInterfaceName.javaClassOrInterfaceNameJavaclassinterfaceclassesinterface3.2.java2.22.3Java1)2)3)4)2.3.1/***papplicationnamesample1/p*papplicationdescribingthisclasshandelstherequestoftheclient/p*pcopyrightCopyright®2002/p*pcompanyneusoft/p*ptime2002.02.25/p**@authorBrunce*@versionver3.1*/Java0.0.0-1.0.02.3.2packagepackagepackagetelmecall.presentation.util;2.3.3importimportimporttypename*importtelmecall.presentation.view.bookview//GOODimporttelmecall.presentartion.*//NOTGOOD2.3.4classinterface3.1packagetelmecall.business.console;packagetelmecall.business.exception;packagetelmecall.presentation.util;telmecallbusiness/presentationconsole/exception/util3.2AWTExceptionJava0.0.0-1.0.03.2.1Class//LayoutManagerArrayIndexOutOfBoundsException//ManageLayout//awtException//awtarray_index_out_of_bounds_exception//3.2.2InterfaceInterfaceInterfaceObjectInterface-able-ibleSearchableSortableNetworkAccessibleInterfaceObject3.3booleanresizable;charrecordDelimiter;3.4MIN_VALUEMAX_BUFFER_SIZEOPTION_FIEL_NAME3.5Java0.0.0-1.0.0//showStatusdrawCircleaddLayoutComponent//mouseButton//DrawCircle//add_layout_component//serverRunning//getPropertysetPropertypropertygetHeightsetHeightisPropertypropertyisResizableisVisible3.6breakcontinuefor(inti=0;in;i++){label_one:{if(node[i].name==name){breaklabel_one;}}//label_oneJava0.0.0-1.0.0lable_two:{if(node[i].name==name){breaklabel_two;}}//label_two}4.1zzzzpackagetelmecall.presentation.view;importjava.util.Date;publicclassBookView{privateStringbookID;privateStringbookName;privateStringbookAuthor;publicBookView(){bookID=null;bookName=null;bookAuthor=null;}publicvoidBook(){}}Java0.0.0-1.0.04.2nottab:zcatchforifswitchsynchronizedwhilesuperthiszreturntruezfoo(long_expression1,long_expression2,long_expression3);//RIGHTfoo(long_expression1,long_expression2,long_expression3);//NOTGOODzif(i==42)//RIGHTif(i==42);//NOTGOODzif(i==42)//RIGHTif(i==42);//NOTGOOD4.3TabtabTab44.480,80,//foo(long_expression1,long_expression2,long_expression3);//long_expression1//foo(long_expression1,long_expression2,//long_expression1long_expression3);Java0.0.0-1.0.0//if(long_logical_test_1||long_logical_test2||long_logical_test_3)//long_logical_test_1{statements;}while(long_logical_test_1||long_logical_test2||long_expression3){}zzzztemporarynote//temporarynote:Changethistocallsort()whenthebugsinitarefixedlist-mySort();5.1javap®5.2@deprecated/**Java0.0.0-1.0.0***pcodeMethod/codeHTML**@seejava.lang.Class*@seejava.lang.Class#getDeclaredMethod(String,Class[])*@authorFrank*@version1.15,2001-12-18*@authorMary*@deprecated*/@see@seejavadocHTML@see@see@see#“SeeAlso”javadoc@version@version“”javadoc“-version”HTML@author@author“”javadoc“-author”HTMLJava0.0.0-1.0.0HTML@deprecatedJava1.1@deprecated5.3publicprotectedjavadocprivate/***codedouble/code**blockquotepre*codeDouble.longBitsToDouble(0x7fefffffffffffffL)/code*/pre/blockquote**/publicstaticfinaldoubleMAX_VALUE=1.79769313486231570e+308;5.4JDK/SDK/*****@paramsthestringtobeparsed.*@returnthedoublevaluerepresentedbythestringargument.*@exceptionNumberFormatExceptionifthestringdoesnotcontaina*parsabledouble.*@seejava.lang.Double#valueOf(String)*@since1.2Java0.0.0-1.0.0*/@param@param“”“”@return@return“”@exception“”@exception“”“”@since@sincesince()@see5.2.15.55.2Java0.0.0-1.0.05.65.6.1//WangGang2001-12-18//StringshowMessage=null;StringshowMessage=“”;zbugzz5.6.25.6.15.6.3packageimportLogzz(/)z(/)zzJava0.0.0-1.0.0zmain()6.1extendsimplementspublicclassCounterSetextendsObservableimplementsCloneable6.2(/)protectedint[]packets;6.3(/)publicint[]getPackets(){returncopyArray(packets,offset);}publicint[]getPackets(){returnpackets;}publicvoidsetPackets(int[]packets){this.packets=packets;}6.4publicCounterSet(intsize){this.size=size;Java0.0.0-1.0.0}6.5()6.6final6.7mainmain(String[]args),Java0.0.0-1.0.0pulicstaticvoidmain(String[]args){……}[public]interfaceInterfaceName[extendsSuperInterfaces]{InterfaceBody}SuperInterfaces{}7.18.18.1.1a=b+c;//RIGHTcount++;//RIGHTa=b+c;count++;//NOTGOOD8.1.2finalJava0.0.0-1.0.0intj=4;//RIGHTinti,k;//ACCEPTABLEinti,j=4,k;//NOTGOOD8.1.3[][charbuf[];//NOTGOODchar[]buf;//GOODString[]getNames(){//RIGHT,methodreturnvalue8.1.4returnreturnreturn(true);//WRONGreturntrue;//RIGHTreturn(s.length()+s.offset);//RIGHT8.28.2.1{}z{}if(i0){i++}if(i0){i++};z{}znullIDE{IDE{Java0.0.0-1.0.08.2.2IFif(condition){statements;}if(condition){statements;}else{statements;}8.2.3FORfor(initialization;condition;update){statements;}8.2.4WHILEwhile(condition){statements;}while(true){statements;}8.2.5DO-WHILEdo{statements;}while(condition);8.2.6switchswitch(condition){case1:case2:statements;break;Java0.0.0-1.0.0default:statements;break;}8.2.7trytry{statements;}catch(exception-declaration){statements;}try{statements;}finally{statements;}try{statements;}catch(exception-declaration){statements;}finally{statements;}8.2.8synchronizedsynchronized(expr

1 / 27
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功