还剩23页未读,继续阅读
本资源只提供10页预览,全部文档请下载后查看!喜欢就下载吧,查找使用更方便
文本内容:
.反射机制什么是反射机制,反射机制应用[struts1中反射机制的应用〕在运行状态中,对于任意一个类,都可以知道它的所有属性和方法,对于任意一个对象都可以调用它的任意一个方法,这种动态获取信息以及动态调用对象的方法的功能叫做java反射机制
2.equals和二二的区别类里面有什么方法要重载的一般简单数据类型用“二二〃比拟,复杂的数据类型可以用“二二〃也可以用equals“二二〃比拟时会比拟变量是否为统一对象并且内存地址一样才会返回true,用equals进展比拟是要看方法是在哪个类实现的String a=new Stringhello;String b=new String〃hello〃;String c=b;System,out.printina==b;falseSystem,out.printin a.equals b;trueSystem,out.printlnc==b;trueSystem,out.printin a.equals IgnoreCase b;trueObject d=new Object;Object f=new Object;System,out.printind==f;falseSystem,out.printlnd.equals f;falseDouble h=new Double2;*©param schema*Ref模式名*©param name*Ref名称*@param type*byVai数据源类型*/
2.4域注释域注释可以出现在注释文档里面,也可以不出现在注释文档里面用/**…*/的域注释将会被认为是注释文档热出现在最终生成的HTML报告里面,而使用/*…*/的注释会被忽略例如/*由于triger和表用一个DMSource,所以要区分和表的迁移成功标记*/boolean isTrigerSuccess=false;又例如:/**由于triger和表用一个DMSource,所以要区分和表的迁移成功标记*/boolean isTrigerSuccess=false;再例如/***The X-coordinate of the component.**@see ftgetLocation*/int x=1263732;
2.5方法注释方法注释采用/**…*/,描述局部注明方法的功能,块标记局部注明方法的参数,返回值,异常等信息例如/***设置是否有外码约束*©param conn*Connection与数据库的连接*/
2.6定义注释规那么同域注释3注释块标记
3.1标记的顺序块标记将采用如下顺序•••12@param classes,interfaces,methods andconstructors only3©return methodsonly4©exception©throws isa synonymadded inJavadoc
1.2*©authorclasses andinterfaces only,required.@versio.classe.an.interface,only,required.Se.footnot.15©see6@since7©serial or@serialField or©serialData8©deprecated seeHow andWhen ToDeprecate APIs9•••一个块标记可以根据需要重复出现屡次,屡次出现的标记按照如下顺序©author按照时间先后顺序chronological@param按照参数定义顺序declaration©throws按照异常名字的字母顺序alphabetically@see按照如下顺序@see#field©see#ConstructorType,Type...@see#ConstructorType id,Type id...©see ttmethodType,Type,...©see ttmethodType id,Type,id...@seeClass©see Class#field@see Class#Constructor Type,Type...@see Class#ConstructorType id,Type id©see Class#methodType,Type,...©see Class#methodType id,Typeid,...©see package.Classftfield©see package.ClassttConstructorType,Type...@see package.ClassWConstructorType id,Typeid©see package.ClassttmethodType,Type,...©see package.Class#methodType id,Type,id@see package
3.2标记介绍
3.
3.
2.2©return标记返回为空void的构造函数或者函数,@return可以省略如果返回值就是输入参数,必须用与输入参数的@parani一样的描述信息必要的时候注明特殊条件写的返回值
3.
2.3©throws标记©throws以前使用的是©exception©throws的内容必须在函数的throws局部定义
3.
2.4©author标记类注释标记函数注释里面可以不出现@author
3.
2.5©version类注释标记函数注释里面可以不出现©version
3.
2.6©since类注释标记标明该类可以运行的JDK版本例如
3.
2.7©deprecated由于某种原因而被宣布将要被废弃的方法/***©deprecated Asof JDK
1.1,replaced by*setBounds*@see#setBoundsint,int,int,int
3.
2.8©link标记语法{©link package,classttmember labelLabel为链接文字package,classttmember将被自动转换成指向package,class的member文件的URLO4HTML代码的使用在注释描述局部可以使用HTML代码表示段落表示自动标号5注释例如/***Graphics isthe abstractbase classfor allgraphics contexts*which allowan applicationto drawonto componentsrealized on*various devicesor ontooff-screen images.*A Graphics object encapsulatesthe state information needed.fo.th.variou.renderin.operation,tha.Jav.supports.This*stateinformationincludes:*see setXORMode*Coordinates areinfinitely thinand liebetween thepixels of theDouble i=new Double2;System,out.printinh-i;falseSystem.out.printin h.equals i;trueString str=abc〃;String strl=str;System.out.printin str==strl;trueSystem,out.printin str.equals strl;true
3.forward和redirect的区别Forward是效劳器内部重定向,效劳器接到接到请求后访问url获取响应然后发给浏览器,浏览器不知效劳器发送到内容是从哪里来的,所以地址栏不会变化Redirect是效劳器接收客户端请求后,发个状态码给浏览器,浏览器再次请求url,此时地址栏会变化转发会可以保存存在request中的数据,而重定向会丧失这些东西
4.servlet的周期,service方法为多线程的,多个线程共享一个servlet实例,该实例创立的时间Servlet要注意的问题〔不可以有成员变量Servlet容器负责加载并实例servlet,客户端发送请求时Servlet容器会查找内存中是否存在Servlet实例,如果不存在,就创立一个Servlet实例,如果存在就直接从内存中取出该实例响应请求Servlet容器加载好Servlet后,然后调用Init对Servlet进展初始化,然后调用service处理请求,*output device.*Operations whichdraw theoutline of a figure operate bytraversing*along theinfinitely thinpath witha pixel-sized penthat hangs*down andto the right of the anchorpoint onthe path.*Operations whichfill a figureoperateby fillingthe interior*oftheinfinitely thinpath.*Operations whichrender horizontaltext renderthe ascending*portion ofthe charactersentirely abovethe baselinecoordinate.**Some importantpoints toconsider arethat drawing a figurethat*covers agiven rectanglewill occupyone extrarow ofpixels on*the rightand bottomedges comparedto fillingafigurethatis*bounded bythat samerectangle.*Also,drawingahorizontal linealong the same ycoordinate as*the baseline ofalineoftext willdraw theline entirelybelow*the textexcept forany descenders.*Both ofthese propertiesare due to thepen hangingdown andto*therightfrom thepath thatit traverses.**All coordinateswhich appearas arguments to themethods of this*Graphics objectare consideredrelative to the translationorigin*ofthisGraphics objectprior to the invocationofthemethod.*All renderingoperations modifyonly pixelswhich liewithinthe*area boundedby boththe currentclip ofthe graphics context*and theextents ofthe Componentused tocreate theGraphicsobject.**©author SamiShaio*©author Arthurvan Hoff*©version%I%,%G%public abstractclass Graphics{/***Draws asmuch ofthe specifiedimage asis currentlyavailable*with itsnorthwest cornerat thespecified coordinatex,y.*This method will returnimmediately inall cases,even if the*entire imagehas not yet beenscaled,dithered andconverted*for thecurrent outputdevice.*If thecurrent outputrepresentation isnotyetcomplete thenthemethodwillreturn falseand theindicated@link ImageObserver}object willbe notifiedas theconversionprocess progresses.©param imgtheimageto bedrawn@param xthe x-coordinate ofthe northwestcornerof thedestination rectanglein pixels@param ythe y-coordinate ofthe northwestcornerof thedestination rectanglein pixels@param observertheimageobserver tobe notifiedas moreo.th.imag.i.converted.Ma.b.・*null*©return trueiftheimage iscompletely*loaded andwas paintedsuccessfully;*false otherwise.*@see Image*@see ImageObserverpublic abstractboolean drawlmageImageimg,int x,int y,ImageObserver observer;/***Dispose ofthe system resources usedby this graphicscontext.*The Graphicscontext cannotbe usedafter beingdisposed of.*While thefinalization processofthegarbage collectorwill*alsodispose ofthesamesystemresources,duetothe number*of Graphics objects thatcan becreated inshort timeframes*it ispreferableto manuallyfree theassociated resources*using thismethodrather thanto relyon afinalization*process whichmay nothappen foralong periodof time.*Graphicsobjectswhich areprovided asargumentstothe paint*andupdate methodsof Componentsare automaticallydisposed,b.th.syste.whe.thos.method,return.Programmer,should,*for efficiency,callthe disposemethod whenfinished using*a Graphicsobject onlyif itwascreated directlyfrom a*Component oranother Graphicsobject.*@see#create int,int,int,int*@see#finalize*@seeComponent#getGraphics*@see ComponentttpaintGraphics*@see ComponentttupdateGraphicspublicabstract voiddispose;/***Disposes ofthisgraphicscontext onceit isno longer*referenced.*@see#dispose public void finalize{dispose;最后容器调用Servlet的destroy销毁实例
5.在struts中request请求流程客户端发送请求,请求的一般是以*.do个格式发送,被ActionServlet拦截到,读取struts配置文件,将请求封装到指定的formBean中,根据配置访问指定actionBean调用方法,跳转到指定页面
6.容器托管事务管理
7.数据库分页sql语句,比方显示第二十条到第十四条记录mysql oracleserver实现SQL Server:SELECT TOP页大小*FROM tablelWHEREid NOTINSELECT TOP页大小*页数T idFROM tablelORDER BYidORDER BYidMY SQL:SELECT*FROM Tablellimit起始行,页大小ORACLE:SELECT*FROM SELECTROWNUM r,tl.*FROM Tableltl)t2WHERE t
2.r〉二起始行AND t2〈二完毕行
8.Java里的克隆是什么,什么是浅拷贝什么是深拷贝HashSet之间的拷贝是浅拷贝还是深拷贝,为什么
2.浅拷贝只是单纯的拷贝对象,所有的对其他对象的引用仍然指向原来的对象;深拷贝相反,所有的对其他对象的引用指向新复制的对象
9.是么是序列化,为什么要实现序列化,如何实现序列化IdserialVersionUID,什么时候创立简单的说就为了保存在内存中各种对象的状态,并且可以把保存的对象然后再读出来一种机制当你想把一个对象保存到数据库或者硬盘中时当你想在网络中传输一个对象时当你想通过RMI传输对象时实现Serializable就可以实现序列化了
10.文档注释java文档注释标记(简单来说,Java的序列化机制是通过在运行时判断类的serialVersionUID来验证版本一致性的在进展反序列化时,JVM会把传来的字节流中的serialVersionUID与本地相应实体(类)的serialVersionUID进展比拟,如果一样就认为是一致的,可以进展反序列化,否那么就会出现序列化版本不一致的异常当实现java.io.Serializable接口的实体[类)没有显式地定义一个名为serialVersionUID,类型为long的变量时,Java序列化机制会根据编译的class自动生成一个serialVersionUID作序列化版本比拟用,这种情况下,只有同一次编译生成的class才会生成一样的serialVersionUID如果我们不希望通过编译来强制划分软件版本,即实现序列化接口的实体能够兼容先前版本,未作更改的类,就需要显式地定义一个名为serialVersionUID,类型为long的变量,不修改这个变量值的序列化实体都可以相互进展串行化和反串行化)java文档注释TrackBack:d1注释文档的格式注释文档将用来生成HTML格式的代码报告,所以注释文档必须书写在类、域、构造函数、方法、定义之前注释文档由两局部组成一一描述、块标记例如/**Th.doGe.metho,o.th.servlet.・*This methodis calledwhen aform hasits tagvalue methodequals toge**@param request*the requestsend bythe clienttothe server*@param response*the responsesend bytheservertotheclient*©throws ServletException*if anerror occurred*©throws lOException*if anerror occurred*/publicvoiddoGet HttpServletRequestrequest,HttpServletResponseresponse throwsServletException,lOException{doPost request,response;前两行为描述,描述完毕后,由@符号起头为块标记注视2注释的种类
2.1文件头注释文件头注释以/*开场,以*/完毕,需要注明该文件创立时间,文件名,命名空间信息例如/**Created on2019-7-2*/
2.2类、接口注释类、接口的注释采用/**…*/,描述局部用来书写该类的作用或者相关信息,块标记局部必须注明作者和版本例如/**Title:XXXX DRIVER
3.0*Description:XXXX DRIVER
3.0Copyright:Copyright c2019Company:XXXX**©author JavaDevelopment Group*©version
3.0*/例如/***A classrepresenting awindow onthe screen.*For example:**Window win=new Windowparent;*win.show;***©author SamiShaio*©version%I%,%G%*@see java.awt.BaseWindow*@see java.awt.Buttonclass Windowextends BaseWindow{
2.3构造函数注释构造函数注释采用/**…*/,描述局部注明构造函数的作用,不一定有块标记局部例如/***默认构造函数/*有例如/***带参数构造函数,初始化模式名,名称和数据源类型。
个人认证
优秀文档
获得点赞 0