书签 分享 收藏 举报 版权申诉 / 70
上传文档赚钱

类型JAVA编码规范(开发培训讲义)模板课件.ppt

  • 上传人(卖家):晟晟文业
  • 文档编号:4032922
  • 上传时间:2022-11-05
  • 格式:PPT
  • 页数:70
  • 大小:351.73KB
  • 【下载声明】
    1. 本站全部试题类文档,若标题没写含答案,则无答案;标题注明含答案的文档,主观题也可能无答案。请谨慎下单,一旦售出,不予退换。
    2. 本站全部PPT文档均不含视频和音频,PPT中出现的音频或视频标识(或文字)仅表示流程,实际无音频或视频文件。请谨慎下单,一旦售出,不予退换。
    3. 本页资料《JAVA编码规范(开发培训讲义)模板课件.ppt》由用户(晟晟文业)主动上传,其收益全归该用户。163文库仅提供信息存储空间,仅对该用户上传内容的表现方式做保护处理,对上传内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知163文库(点击联系客服),我们立即给予删除!
    4. 请根据预览情况,自愿下载本文。本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
    5. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007及以上版本和PDF阅读器,压缩文件请下载最新的WinRAR软件解压。
    配套讲稿:

    如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。

    特殊限制:

    部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。

    关 键  词:
    JAVA 编码 规范 开发 培训 讲义 模板 课件
    资源描述:

    1、Lishoulin,PTC普联软件(中国)有限公司2011年度入职培训,济南燕山学院PANSOFTJULY,2011编码规范(JAVA版)JAVA之路JAVA开发人员编码规范Technology Team Progresscom.pansoft.financecom.pansoft.public class JRaster;class JImageSprite interface IRasterDelegate;interface IStoring;run();runFast();getBackground();char c;int i;float myWidth;int mEmployeeI

    2、d;String mName;Customer mCustomer;public void callMe(int pAge,String pName)static final int MIN_WIDTH =4;static final int MAX_WIDTH =999;static final int GET_THE_CPU =1;/*Classname *Version information *Date *Copyright notice */package java.awt;import java.awt.peer.CanvasPeer;/正常断行 someMethod(int an

    3、Arg,Object anotherArg,String yetAnotherArg,Object andStillAnother)./若断行后很靠右,则下面行可以缩进8个空格,看上去更美 观。private static synchronized horkingLongMethodName(int anArg,Object anotherArg,String yetAnotherArg,Object andStillAnother)./缩小过少,不易阅读1 if(condition1&condition2)2|(condition3&condition4)3|!(condition5&con

    4、dition6)4 doSomethingAboutIt();/这一行不易阅读识别 /较多的缩进,便于阅读5 if(condition1&condition2)6|(condition3&condition4)7|!(condition5&condition6)8 doSomethingAboutIt();1 alpha=(aLongBooleanExpression)?beta:gamma;2 alpha=(aLongBooleanExpression)?beta :gamma;3 alpha=(aLongBooleanExpression)?beta :gamma;/*Here is a

    5、block comment.*/1 if(condition)2 /*Handle the condition.*/3 /code.4 1 if(a=2)2 return TRUE;/*special case*/3 else 4 return isPrime(a);/*works only for odd a*/5 1 if(foo 1)2./Do a double-flip.3 4 else 5.return false;/Explain why here.6 7./if(bar 1)8 /Do a triple-flip.9 /10 /else 11 /return false;12 /

    6、*The Example class provides.*/public class Example .1 int level;/indentation level2 int size;/size of table /这样不好 3 int level,size;4 int foo,fooarray;/错误写法错误写法1 void myMethod()2 int int1=0;/好的声明3 if(condition)4 int int2=0;/不好的声时5 .6 7 1 class Sample extends Object 2 int ivar1;3 int ivar2;4 Sample(in

    7、t i,int j)5 ivar1=i;6 ivar2=j;7 8 int emptyMethod()9 .10 1 argv+;/Correct 2 argc-;/Correct 3 argv+;argc-;/AVOID!1 if(this.isExist(“0001”)2 argc-;/Correct 3 System.out.println(“HELLO”);4 1.return;2.return myDisk.size();3.return(size?size:defaultSize);1.if(condition)2 statements;3 4 if(condition)5 sta

    8、tements;6 else 7 statements;8 9 If(condition)10 statements;11 else if(condition)12 statements;13 else 14 statements;15 if(condition)/非法的,应该以包括 statement;for(initialization;condition;update)statements;while(condition)statements;while(condition);do statements;while(condition);1 switch(condition)2 case

    9、 ABC:3 statements;4 /*falls through*/5 case DEF:6 statements;7 break;8 case XYZ:9 statements;10 break;11 default:12 statements;13 break;14 try statements;catch(ExceptionClass e)statements;finally statements;1 a+=c+d;2 a=(a+b)/(c*d);3 while(d+=s+)4 n+;5 6 printSize(size is +foo+n);7 for(expr1;expr2;e

    10、xpr3)8 myMethod(byte)aNum,(Object)x);9 myMethod(int)(cp+5),(int)(i+3)+1);1 ooBar.fChar=barFoo.lchar=c;/禁止此种方法 2 if(c+=d+)/AVOID!(Java disallows).3 /应该写成 4 if(c+=d+)!=0).5 1 d=(a=b+c)+r;/AVOID/应该写成 2 a=b+c;3 d=a+r;1 if(booleanExpression)2 return true;3 else 4 return false;5 应该代之以如下方法:6 return boolean

    11、Expression;1 if(condition)2 return x;3 4 return y;应该写做:5 return(condition?x:y);1 JResponseObject RO=new JResponseObject();/获得一个可用连接,这个连接可能获取不到。2 JConnection conn=3 (JConnection)JActiveDComDM.AbstractDataActiveFramework.InvokeObjectMethod(4 DBManagerObject,GetDBConnection,Param);/因此,这里要判断一下。5 if(conn

    12、=null)/如果是无效连接,要返回错误信息。6 RO.ErrorCode=-1;7 RO.ErrorString=无法获得数据库连接;8 return RO;9 1 try 2 DBOFormService.3 SQLQuery(conn,msgInput.asStringValue(SqlText,),IE.getResultMessage();/根据需要,返回对象类型的结果。4 RO.ResponseObject=IE;5 catch(Exception E)/发生异常时,要把异常信息返回。6 RO.ErrorCode =-1;7 RO.ErrorString=E.getMessage(

    13、);8 9 finally /finally里执行连接的关闭操作。10 conn.close();11 12 return RO;1 Statement pSession=null;2 ResultSet pRS =null;3 pSession=conn.createStatement();4 String pSql=“SELECT*FROM LSCONF WHERE 1=1”;5 try6 pRS=pSession.executeQuery(pSql);7 if(pRS.next()8 /这里是逻辑代码。用来取数。9 10 11 catch(Exception E)12 /这里是一个异常,

    14、需要把异常信息想法通知调用者。可以使用throw 抛出。13 1 finally 2 try 3 /清理操作。4 if(pRS!=null)5 pRS.close();6 7 if(pSession!=null)8 pSession.close();9 10 11 catch(Exception EE)12 /这里可能也有异常,不需要抛出。13 14 1 IAction mActStop =TAction.Create(STOP,停止,S,this,onStop,SYS_STOP);2 JButton btStop=new JButton(“”);3 btStop.setAction(mAct

    15、Stop);4 public boolean onStop(IAction pAct,ActionEvent pEvt)5 return true;/这里即是处理代码。6 7 JMenuItem pMM=new JMenuItem();8 pMM.setAction(mActStop);1 public static String F(String pStringFormat,String P1)2 public static String F(String pStringFormat,String P1,String P2)3 public static String F(String pS

    16、tringFormat,String P1,String P2,String P3)4 public static String F(String pStringFormat,String P1,String P2,String P3,String P4)5 public static String F(String pStringFormat,String P1,String P2,String P3,String P4,String P5)6 String pData=TString.F(科目%s不存在!;,”1001”);普联软件(中国)有限公司2011年度入职培训,济南燕山学院PANSOFTJULY,2011编码规范(JAVA版)本次课程结束!Technology Team Progress

    展开阅读全文
    提示  163文库所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
    关于本文
    本文标题:JAVA编码规范(开发培训讲义)模板课件.ppt
    链接地址:https://www.163wenku.com/p-4032922.html

    Copyright@ 2017-2037 Www.163WenKu.Com  网站版权所有  |  资源地图   
    IPC备案号:蜀ICP备2021032737号  | 川公网安备 51099002000191号


    侵权投诉QQ:3464097650  资料上传QQ:3464097650
       


    【声明】本站为“文档C2C交易模式”,即用户上传的文档直接卖给(下载)用户,本站只是网络空间服务平台,本站所有原创文档下载所得归上传人所有,如您发现上传作品侵犯了您的版权,请立刻联系我们并提供证据,我们将在3个工作日内予以改正。

    163文库