版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
荊楚理工學(xué)院學(xué)生課程考核論文學(xué)院:計(jì)算機(jī)工程學(xué)院專業(yè):軟件技術(shù)班級(jí):軟件技術(shù)(1)班課程:專業(yè)英語論文題目:JAVA介紹學(xué)生姓名:王選時(shí)間:2012年12月2日成績(jī)?cè)u(píng)定:IntroductiontoJavaautor:MartinNgobye.source:ComputingStaticSliceforJavaProgramsJavaisdesignedtomeetthechallengesofapplicationdevelopmentinthecontextofheterogeneous,network-widedistributedenvironments.Paramountamongthesechallengesissecuredeliveryofapplicationsthatconsumetheminimumofsystemresources,canrunonanyhardwareandsoftwareplatform,andcanbeextendeddynamically.Javaoriginatedaspartofaresearchprojecttodevelopadvancedsoftwareforawidevarietyofnetworkdevicesandembeddedsystems.Thegoalwastodevelopasmall,reliable,portable,distributed,real-timeoperatingplatform.Whentheprojectstarted,C++wasthelanguageofchoice.ButovertimethedifficultiesencounteredwithC++grewtothepointwheretheproblemscouldbestbeaddressedbycreatinganentirelynewlanguageplatform.DesignandarchitecturedecisionsdrewfromavarietyoflanguagessuchasEiffel,SmallTalk,ObjectiveC,andCedar/Mesa.Theresultisalanguageplatformthathasprovenidealfordevelopingsecure,distributed,networkbasedend-userapplicationsinenvironmentsrangingfromnetwork-embeddeddevicestotheWorld-WideWebandthedesktop.ThedesignrequirementsofJavaaredrivenbythenatureofthecomputingenvironmentsinwhichsoftwaremustbedeployed.ThemassivegrowthoftheInternetandtheWorld-WideWebleadsustoacompletelynewwayoflookingatdevelopmentanddistributionofsoftware.Toliveintheworldofelectroniccommerceanddistribution,Javamustenablethedevelopmentofsecure,highperformance,andhighlyrobustapplicationsonmultipleplatformsinheterogeneous,distributednetworks.Operatingonmultipleplatformsinheterogeneousnetworksinvalidatesthetraditionalschemesofbinarydistribution,release,upgrade,patch,andsoon.Tosurviveinthisjungle,Javamustbearchitectureneutral,portable,anddynamicallyadaptable.TheJavasystemthatemergedtomeettheseneedsissimple,soitcanbeeasilyprogrammedbymostdevelopers;familiar,sothatcurrentdeveloperscaneasilylearnJava;objectoriented,totakeadvantageofmodernsoftwaredevelopmentmethodologiesandtofitintodistributedclient-serverapplications;multithreaded,forhighperformanceinapplicationsthatneedtoperformmultipleconcurrentactivities,suchasmultimedia;andinterpreted,formaximumportabilityanddynamiccapabilities.Together,theaboverequirementscomprisequiteacollectionofbuzzwords,solet’sexaminesomeofthemandtheirrespectivebenefitsbeforegoingon.What’scompletelynewisthemannerinwhichJavaanditsrun-timesystemhavecombinedthemtoproduceaflexibleandpowerfulprogrammingsystem..DevelopingyourapplicationsusingJavaresultsinsoftwarethatisportableacrossmultiplemachinearchitectures,operatingsystems,andgraphicaluserinterfaces,secure,andhighperformance,WithJava,yourjobasasoftwaredeveloperismucheasier—youfocusyourfullattentionontheendgoalofshippinginnovativeproductsontime,basedonthesolidfoundationofJava.Thebetterwaytodevelopsoftwareishere,now,broughttoyoubytheJavalanguageplatform.VerydynamiclanguageslikeLisp,TCL,andSmallTalkareoftenusedforprototyping.Oneofthereasonsfortheirsuccessatthisisthattheyareveryrobust—youdon’thavetoworryaboutfreeingorcorruptingmemory.Similarly,programmerscanberelativelyfearlessaboutdealingwithmemorywhenprogramminginJava,Thegarbagecollectionsystemmakestheprogrammer’sjobvastlyeasier;withtheburdenofmemorymanagementtakenofftheprogrammer’sshoulders,storageallocationerrorsgoaway.AnotherreasoncommonlygiventhatlanguageslikeLisp,TCL,andSmallTalkaregoodforprototypingisthattheydon’trequireyoutopindowndecisionsearlyon—theselanguagesaresemanticallyrich.Javahasexactlytheoppositeproperty:itforcesyoutomakeexplicitchoices.Alongwiththesechoicescomealotofassistance—youcanwritemethodinvocationsand,ifyougetsomethingwrong,yougettoldaboutitatcompiletime.Youdon’thavetoworryaboutmethodinvocationerror.TheJavabeginnermustgrasp30basicconceptsBasicconcept1.InOOPtheonlyrelationsiswhattheobject’sinterface,suchasthecomputersellerheleavesaloneinternalstructureofelectricalsource,butheisonlyconcernedaboutthatwhetherthepowerwillbesuppliedtoyou,alsosolongasknowcanornotbutisnothowandwhy.Allproceduresaremakeupofcertainattributeandthebehaviorobject,thedifferentobjectvisitinvokesthroughthefunctioninvocation,betweentheobjectallintercommunionareinvokethroughthemethodinvocation,Byobjectdataencapsulation,enhancesreuserateverymuch..2.InOOPthemostimportantthoughtisclass,theclassisthetemplate,isablueprint,constructanobjectfromaclass,namelyconstructaninstanceoftheclass.3.Encapsulation:isthatcombinesthedataandthebehaviorinapackage)andhidesthedatatherealizationprocesstotheobjectuser,inanobjectdataiscalleditsinstancefield.4.Throughexpandsaclasstoobtainanewclassiscalledinheritance,butallclassesareconstructedbytheobjectsuperrootclassofexpansion,superrootclassofasfollowscanmaketheintroduction.5.Object3principalcharacteristicsBehavior---explainedthisobjectcanmakewhat.Tate---whentheobjectexertsthemethodobjectreflection.Dentity---andothersimilarbehaviorobjectsdiscriminationsymbols.Eachobjecthasonlyindentityandamongthreecharacteristicstheyaffectmutually.6.Relationsamongclasses:Use-a:DependentrelationHas-a:PolymerizationrelationIs-a:inheritorrelation--example:AclasshasinheritedBclass,thistimeAclassnotonlyhasBclassofmethod,butalsohasitsownmethod(Individualityexistsingeneralcharacter)7.Structureobjectusestructure:Structureproposing,thestructureisonespecialmethod,thestructureobjectandtoitsinitialization.Example:ADataclassofstructurecallsDataNewData()---structureanewobject,alsoinitializecurrenttime.Datahappyday=newData()---anobjectevaluatesanvariablehappyday,thusenablesthisobjecttobeusedmanytimes,herebestatedthecausevariableandtheobjectvariablearedifferent.Newreturnsthevalueisaquotation.Constructorcharacteristic:Theconstructormayhave0,oneormanyparametersTheconstructorandtheclasshavethesamenameAclassmayhavemanyconstructor.TheconstructorhasnotreturnedvalueTheconstructoralwaysbetogetherusedwiththenewoperator8.Overloading:Whenmanymethodshavethesamenamewhenincludesthedifferentparameter,thenhastheoverloadingWhichmethoddoesthecompilerhavetochooseinvokes.9.Package:Javaallowoneormanyclassestobecometogetherasgroup,iscalledpackage,toorganizingdutyeasily,thestandardJavastorehousedividesintomanypackagesJava.Langjava.Utiljava,netandsoon,thepackageislayeredandalljavapackagesareinjavaandinajavaxpackage.10.Extendablethought:permittoconstructnewclassonexistingclasses,whenyouextendtheclasswhichalreadyexisted,thenyoureusethisclassofmethodandthefield,atthesametimeyoumightaddthenewmethodandthefieldinthenewclass.11.Expandableclass:Theexpandableclassfullymanifestedis-atoextendtherelationsTheformis:Class(subclass)extends(baseclass).12.Multi-modality:Injava,theobjectvariableismulti-modalityButinjavadoesnotsupportmultipleextend.13.Dynamiccombine:themechanismofinvokingobjectmethodmechanism.1)compilerexaminesobjectstatementtypeandmethodname.2)thecompilerexaminesthatmethodinvokesparametertype.3)staticcombine:Ifthemethodtypeispriavtestaticthefinal,compilercanaccuratelyknowwhichmethodshouldinvoke.4)whentheprocedurerunsandusesdynamiccombinetoinvokeamethod,themethodeditionwhichthenhypothesizedmachinemustinvokextheobjectactualtypewhichaimsattomatch.5)dynamiccombine:isaveryimportantcharacteristic,itcancausetheproceduretochangeagainmayexpandbutdoesnotneedtotranslatehassavedthecode.14.Finalclass:Inordertopreventotherpeoplederivethenewclassfromyoursclass,thisclassiscannotexpanded.15.Thedynamicinvocationspendlongertimethanthestaticinvocationexpenditure.16.Abstractclass:Stipulatedormanyabstractmethodsclassofitselfmustdefineisabstract.Example:PublicabstractstringgetDescripition17.InJavaeachclassisbeextendedbyobjectclass.18.equalandtoStringmethodinobjectclass.Equalusesintestinganobjectiswhetherequalwithanotherobject.ToStringreturnstorepresentthisobjectthestringofcharacter,eachclasscannearlyoverloadingthismethod,inordertoreturnstothecurrentconditionthecorrectexpression.(ThetoStringmethodisaveryimportantmethod)19.Generalprogramming:Anyclassoftypeallvaluesallmayreplacewithaobjectclassofvariable.20.Thearraytabulates:TheArrayListdynamicarraytabulates,isaclassofstorehouse,definesinjava.Inuitlpackage,butautomaticcontrolarraysize.21.inclassandclassofobject,getclassmethodreturnstotheclasstypeanexample,whentheprocedurestartcontainscanincreaseinthemainmethodclass,hypothesizedconfidentialincreaseallclasseswhichheneeds,eachincreaseclassallmustincreasetheclasswhichitneeds.22.Theclass:classmightdynamicoperatethejavacodeforthecompilationtheproceduretoprovidetheformidablefunctionreflection,thisfunctionwasJavaBeansisspeciallyuseful,theusereflectedJavatobeabletosupporttheVBcedureofanalysisclassabilityiscalledthereflector,inJavatoprovidethisfunctionthepackagetocallJava.Lang.Thereflectreflectionmechanismisextremelyformidable.1)whenrunanalysisclassability.2)whenrunsearchesobservesaclassofobject.3)realizesthegeneralarrayoperationcode.4)providesthemethodobject.Butthismechanismmainlyaimsatthetoolbutnottheapplicationandtheprocedure.Inthereflectionmechanismmostimportantpartisthatpermitsclassthatyouinspectstructure.WithtoAPIincludes:Java.Lang.Reflect.Fieldreturnstothefield.Java.Reflect.Methodreturnstothemethod.Java.Lang.Reflect.Constructorreturnstotheparameter.Methodpointer:Javadoesnothavethemethodpointer,makesamethodaddressanothermethod,mayinvokeitinbehind,erface:shouldshowingclasscoulddowhatbutnottoassignhowtodo,aclassmayrealizeoneormanyinterfaces.24.Theinterfaceisnotaclass,butistoconformstoainterfacerequestclassofsetofstandard.Ifrealizesainterfacetoneed2steps:1)thestatementclassneedstorealizeassignstheinterface.2)providesintheinterfaceallmethodsdefinition.StatedaclassrealizesainterfacetoneedtousetheimplementskeywordsClassactionBimplementsComparableitsactionbneedstoprovidetheCompareTomethod,theinterfaceisnottheclass,cannotuseanewexampleinterface.25.Aclassonlythenasuperclass,butaclasscanrealizemanyinterfaces.InaJavaimportantinterface:Cloneable26.Theinterfaceandcall-back:toprogramsacommonlyusedpatterniscall-back,inthepattern,youmayreferwhenthisclassofpatternsettledspecifictimeoccursreturnstoadjustsontheobjectthemethod.Example:ActionListenerinterfacemonitor.SimilarAPIincludes:27.Objectclone:Theclonemethodisaobjectprotectionmethod,thismeantyourcodecannotsimpleinvokeit.28.Innerclassaninnerclassdefinitionisthedefinitioninanotherclass.Thereasonis:1)aninnerclassobjectcanvisitfoundsitsobjectrealization,includingprivatedata.2)aboutotherclassesinthesamepackageinthat,innerclasscanbehided.3)theanonymousinnerclassmaytheveryconvenientdefinitionaccent.In4)usesthecategorytobepossibletheextremelyconvenientcompilationeventdriver.29.Agentclass(proxy):1)appointingallcodesthatinterfacesrequest2)allmethods(toStringequals)thatobjectclassdefine30.Datatype:Javaiskindofemphasizingtypelanguage,eachvariableallmustbedeclareditstypesatfirst,injavaaltogetherhas8basictypes.fourkindsarethelong,twokindsarethefloat,oneisthechar,beingusedintheUnicodecodechar,Boolean.1.javaissimpleJavaandC++areverysimilar,butmuchsimpler.Allthehigh-levelprogramminglanguagefeatures,isnotabsolutelynecessaryhavebeendeleted.Forexample,Javadoesnotoverloadoperator,thetitleofthedocument,pre-processing,computingpointer,thestructureofthejoint,multi-dimensionalarray,templatesandimplicittypeconversion.IfyouknowalittleC,C++orPascal,youwillsoonmasterJava.HereisasimpleprocedureJavaHelloWorld:publicclassHelloInternet(publicstaticvoidmain(Stringargv[])(System.out.println("HelloIn-ternet!")))2.Javaisobject-orientedJavaisanobject-orientedprogramminglanguage.Inadditiontothesimpletypes,suchasdigitalandBooleanoperatorsinaddition,Javaisanobjectofmost.Aswithanyobject-orientedlanguages,Javacodealsoorganizedbycategory.Eachcategoryprovidesadefinitionoftheobjectbehavior.Anothertypeofsuccessioncanbeakindofbehavior.Inthecategoryoftherootlevel,oftenthetargetcategory.Javasupportforthesingletypeofinheritedhierarchy.Thismeansthateachcategorycanonlyinheritoneothercategory.Someofthelanguagetoallowmultipleinheritance,butitmaycauseconfusionandunnecessarilycomplicatedlanguage.Forexample,imaginethatanobjectwouldinherittwocompletelydifferentcategory.Javaalsosupportsthekindofsummaryoftheinterface.Thisallowsprogrammerstodefinetheinterfacemethods,anddonothavetorushimmediatelytodeterminethemethodstoachieve.Atypeofinterfacecanbeanumberofpurposesinordertotrulymulti-inheritanceofanumberofadvantages.Theimplementationofanobjectcanbeanynumberofinterfaces.IDLinterfaceandJavainterfaceverysimilar.VeryeasytosetupIDLJcompiler.Inotherwords,JavacanbeusedtocreateaCORBAobjectsystemdistributedobjectsystem.IntheviewofmanycomputersystemsuseIDLinterfaceandCORBAobjects,suchcompatibilityisimportant.3.JavaisatypeofstaticInaJavaprogram,itisessentialtothedefinitionusedbythetarget(numberofcharacters,suchasanarray)type.Thiswillhelpprogrammersquicklyfoundbecausetheprocedurewhenthecompilercandetectthetypeoferror.However,JavaSystemobjectsarealsodynamictypes.Arequirementforthetypeofdynamicisoftenpossible,soprogrammerscanwritetheproceduresfordifferenttypesofobjectstododifferentthings.4.IsaJava-basedcompilerWhenrunningJavaprograms,whichwerefirstcompiledintobytecode.Bytecodeisverysimilartothemachineinstructions,soJavaprogramisveryefficient.However,thebytecodedoesnotspecificallyforaparticularmachine,sononeedtorecompileJavaprogramcanbeinmanydifferentcomputerimplementation.Javasourcecodefileswerecompiledintoacategory,whichisequivalenttoprocessbytecodeperformance.InaJavaclassfile,andanexampleforallofthevariablesareinthelightof,andforthefirsttimeintheimplementationofthecodeberesolved.Thismakesthecodemorecommonandmoreeasilysubjecttorevision,butstillhigh.5.JavaisarchitectureneutralJavalanguageisthesameforeachcomputer.Forexample,simpletypesarethesame:32-bitintegeralways,always64-bitlongintegers.Itisstrange,suchasCandC++programminglanguage,andsofashionableitisnotthecase.Asaresultoftheselanguagessothedefinitionoffreedom,eachofthecompileranddevelopmentenvironmentwillbedifferent,sothatthisprocessnuisancebecomeatransplant.Javaprogramscaneasilygainaccesstotransplants,andthereisnoneedtore-compile.6.JavaisasoundJavaprogramcannotbecausedbythecollapseofthecomputer.Javacarefultestingofthesystemmemoryofeachvisit,makesureitislegitimateandwillnotcauseanyproblems.However,eveniftheJavaprogrammayalsobewrong.Ifthereissomekindofunexpectedthings,theprocesswillnotcollapse,andtoabandontheexception.Proceduresforsuchanexceptionwouldbefoundtoaddressthem.Traditionalcomputerprogramscanaccessthefullmemory.May(unconsciously)toamendanyofthevalueofmemory,whichwillcauseproblems.JavaprogramcanonlyaccessmemorytoallowthemaccesstothosepartsoftheJavaprogramcannotmodifyitdoesnotseektochangethevalue.7.JavaisacompactAstheJavaisdesignedtorunonasmallcomputer,asaprogramminglanguageforthesystemisrelativelysmall.Iteffectivelyinmorethan4MBofRAMtorunonPCmachine.JavatranslatoroccupiedbyonlyafewhundredKB.ThistranslatorfortheJavaplatformindependenceandportabilityisreliable.DuetoJavaisverysmall,itisaverysmallcomputermemory,suchastheJava-basedPC,aswellastelevisionsets,ovens,telephoneandhomecomputer,andsoon,itisideal.8.Javaisamulti-threadedJavaprogramcanrunmorethanonethread.Forexample,itcanbeathreadinatime-consumingtocompletethecalculation,andotheruserstointeractwiththethreadsofdialogue.Therefore,usersdonothavetostopworking,waitingfortheJavacomputingtime-consumingprocess.Inthemulti-threadedprogrammingenvironment,itisoftendifficultbecausemanythingsmayoccuratthesametime.However,Javaprovideseasy-to-usefeaturessimultaneously,sothattheprogrammingeasier.中文翻譯JAVA介紹MartinNgobye.出處:ComputingStaticSliceforJavaProgramsJava是被設(shè)計(jì)用來解決在上下文分布式的異構(gòu)網(wǎng)絡(luò)中應(yīng)用程序開發(fā)的問題。在這些復(fù)雜問題中,首要的是安全發(fā)布應(yīng)用程序、消耗最小的系統(tǒng)資源、可以在任何硬件和軟件平臺(tái)上運(yùn)行以及被動(dòng)態(tài)地?cái)U(kuò)展。Java最初是作為研發(fā)方案的一部分而開發(fā)的,這個(gè)研究方案是為了給廣闊多樣的網(wǎng)絡(luò)設(shè)備和嵌入式系統(tǒng)開發(fā)高級(jí)的軟件。目標(biāo)是開發(fā)一個(gè)小巧的、可靠性高的、可移植的、分布式的、實(shí)時(shí)的操作系統(tǒng)平臺(tái)。當(dāng)這個(gè)方案開始的時(shí)候,C++是精選的語言,但是過了一段時(shí)間,用C++語言遇到的困難也隨之增長(zhǎng),解決這些問題最好的辦法是創(chuàng)造一個(gè)全新的語言平臺(tái)。設(shè)計(jì)和體系結(jié)構(gòu)的決定汲取了多種語言,例如Eiffel、SmallTalk,、ObjectiveC以及Cedar/Mesa。結(jié)果證明這個(gè)語言平臺(tái)是理想的,對(duì)于開發(fā)一個(gè)可靠性高的、可移植的、分布式的、基于終端用戶網(wǎng)絡(luò)的應(yīng)用程序在多種環(huán)境中廣泛搜索從嵌入網(wǎng)絡(luò)的設(shè)備到萬維網(wǎng)和桌上型電腦。Java的需求設(shè)計(jì)通過自然狀態(tài)的,在軟件必須被配置的處理環(huán)境中被推動(dòng)的。因特網(wǎng)和萬維網(wǎng)的巨大發(fā)展導(dǎo)致我們完全地以新的情形著眼于開發(fā)和發(fā)行軟件。對(duì)于全球電子化的商業(yè)和銷售發(fā)行的存在,Java必須使安全的,高性能的和非常健壯的應(yīng)用程序在多平臺(tái)異構(gòu)的,分布式的網(wǎng)絡(luò)中開發(fā)。在異構(gòu)的網(wǎng)絡(luò)中,多平臺(tái)上運(yùn)行會(huì)使傳統(tǒng)配置的二進(jìn)制發(fā)送、釋放、更新、補(bǔ)丁等等無效。為了在這些問題中幸存下來,Java必須是體系結(jié)構(gòu)中立的、可移植的以及可以被動(dòng)態(tài)的修改。為滿足以上的需求而開發(fā)的Java系統(tǒng)是簡(jiǎn)單的,所以它能夠被絕大多數(shù)的程序員進(jìn)行編程;熟悉的,所以當(dāng)前的程序員學(xué)習(xí)Java語言是簡(jiǎn)單的;面向?qū)ο蟮?,為了利用現(xiàn)代的軟件開發(fā)方法學(xué)和適合分布式的客戶機(jī)/服務(wù)器應(yīng)用程序;多線程的,為了高性能在應(yīng)用程序中需要執(zhí)行多個(gè)并發(fā)的活動(dòng),例如多媒體;解釋的,為了最大極限的可移植和動(dòng)態(tài)的容量。同時(shí),以上的需求完全是由收集的時(shí)髦詞語組成的,所以在開始以前讓我們來查看它們中的一些和它們的各自的優(yōu)點(diǎn)。什么是完全新的,樣式風(fēng)格在Java語言和它的運(yùn)行系統(tǒng)結(jié)合它們來產(chǎn)生一個(gè)靈通的且強(qiáng)大的編程系統(tǒng)。在軟件中,用Java語言開發(fā)的你的應(yīng)用程序可以在多種機(jī)器總體結(jié)構(gòu)、操作系統(tǒng)和圖形用戶接口之間移植。運(yùn)用Java語言,諸如軟件開發(fā)者的工作就會(huì)變得簡(jiǎn)單的多——你會(huì)把你的全部精力都集中在最終的目標(biāo):準(zhǔn)時(shí)運(yùn)送革新的產(chǎn)品、基于可靠的構(gòu)造的Java語言。較好的開發(fā)軟件的方法在這里,現(xiàn)在,Java語言平臺(tái)會(huì)帶給你這些。許多動(dòng)態(tài)的語言像Lisp、TCL和SmallTalk通常被應(yīng)用于原型構(gòu)造技術(shù)它們成功原因中的一個(gè)在于它們非常健壯——你沒有必要去擔(dān)心關(guān)于解除或破壞存儲(chǔ)器。同樣的,程序員可以相對(duì)大膽的處理存儲(chǔ)器,當(dāng)在Java語言里面編程的時(shí)候。垃圾回收系統(tǒng)使程序員的工作大為容易,卸下了程序員肩上存儲(chǔ)管理之負(fù)擔(dān),存儲(chǔ)分配錯(cuò)誤不再發(fā)生。一般認(rèn)為像Lisp,TCL,和SmallTalk這樣一些語言十分適合于原型法的另一個(gè)理由,是因?yàn)樗鼈儾灰竽闶茉缙跊Q定的約束——這些語言的語義是很豐富的。Java語言有著嚴(yán)密的對(duì)應(yīng)的屬性:它促使你做出清楚的選擇。伴隨著這些選擇帶來了許多的協(xié)助——你可以寫一個(gè)方法調(diào)用,而且如果你在編寫時(shí)有一些錯(cuò)誤的時(shí)候,在編譯的時(shí)候?qū)?huì)被告知。你沒有必要去擔(dān)心關(guān)于方法調(diào)用的錯(cuò)誤。Java初學(xué)者需掌握的30個(gè)基本概念基本概念:1.OOP中唯一關(guān)系是什么是對(duì)象的接口,就像計(jì)算機(jī)的銷售商不管電源內(nèi)部結(jié)構(gòu)是怎樣的,它只關(guān)心能否給你提供電,也就是只要知道能或不能而不是知道怎樣和為什么會(huì)有電。所有的程序是由一定的屬性和行為對(duì)象組成的,不同的對(duì)象的訪問通過函數(shù)調(diào)用來完成,對(duì)象間所有的交流都是通過方法調(diào)用,通過封裝對(duì)象數(shù)據(jù),很大限度上提高復(fù)用率。2.OOP中最重要的思想是類,類是模板是藍(lán)圖,從類中構(gòu)造一個(gè)對(duì)象,即創(chuàng)建了這個(gè)類的一個(gè)實(shí)例(instance)。3.封裝:就是把數(shù)據(jù)和行為結(jié)合起在一個(gè)包中,并對(duì)對(duì)象使用者隱藏?cái)?shù)據(jù)的實(shí)現(xiàn)過程,一個(gè)對(duì)象中的數(shù)據(jù)叫他的實(shí)例字段(instancefield)。4.通過擴(kuò)展一個(gè)類來獲得一個(gè)新類叫繼承(inheritance),而所有的類都是由Object根超類擴(kuò)展而得,根超類下文會(huì)做介紹。5.對(duì)象的3個(gè)主要特性:Behavior——說明這個(gè)對(duì)象能做什么。Tate——當(dāng)對(duì)象施加方法時(shí)對(duì)象的反映。Dentity——與其他相似行為對(duì)象的區(qū)分標(biāo)志。每個(gè)對(duì)象有唯一的indentity而這3者之間相互影響。6.類之間的關(guān)系:use-a:依賴關(guān)系has-a:聚合關(guān)系is-a:繼承關(guān)系——例:A類繼承了B類,此時(shí)A類不僅有了B類的方法,還有其自己的方法(個(gè)性存在于共性中)。7.構(gòu)造對(duì)象使用構(gòu)造器:構(gòu)造器的提出,構(gòu)造器是一種特殊的方法,構(gòu)造對(duì)象并對(duì)其初始化。例:Data類的構(gòu)造器叫Data。NewData()——構(gòu)造一個(gè)新對(duì)象,且初始化當(dāng)前時(shí)間。Datahappyday=newData()——把一個(gè)對(duì)象賦值給一個(gè)變量happyday,從而使該對(duì)象能夠多次使用,此處要聲明的使變量與對(duì)象變量二者是不同的。new返回的值是一個(gè)引用。構(gòu)造器特點(diǎn):構(gòu)造器可以有0個(gè),一個(gè)或多個(gè)參數(shù)。構(gòu)造器和類有相同的名字。一個(gè)類可以有多個(gè)構(gòu)造器,構(gòu)造器沒有返回值,構(gòu)造器總是和new運(yùn)算符一起使用。8.重載:當(dāng)多個(gè)方法具有相同的名字而含有不同的參數(shù)時(shí),便發(fā)生重載.編譯器必須挑選出調(diào)用哪個(gè)方法。9.包(package)Java允許把一個(gè)或多個(gè)類收集在一起成為一組,稱作包,以便于組織任務(wù),標(biāo)準(zhǔn)Java庫(kù)分為許多包Java.langjava.utiljava,net等,包是分層次的所有的java包都在java和javax包層次內(nèi)。10.繼承思想:允許在已經(jīng)存在的類的基礎(chǔ)上構(gòu)建新的類,當(dāng)你繼承一個(gè)已經(jīng)存在的類時(shí),那么你就復(fù)用了這個(gè)類的方法和字段,同時(shí)你可以在新類中添加新的方法和字段。11.擴(kuò)展類:擴(kuò)展類充分體現(xiàn)了is-a的繼承關(guān)系,形式為:class(子類)extends(基類)。12.多態(tài):在java中,對(duì)象變量是多態(tài)的,而java中不支持多重繼承。13.動(dòng)態(tài)綁定:調(diào)用對(duì)象方法的機(jī)制。1)編譯器檢查對(duì)象聲明的類型和方法名。2)編譯器檢查方法調(diào)用的參數(shù)類型。3)靜態(tài)綁定:若方法類型為priavtestaticfinal編譯器會(huì)準(zhǔn)確知道該調(diào)用哪個(gè)方法。4)當(dāng)程序運(yùn)行并且使用動(dòng)態(tài)綁定來調(diào)用一個(gè)方法時(shí),那么虛擬機(jī)必須調(diào)用x所指向的對(duì)象的實(shí)際類型相匹配的方法版本。5)動(dòng)態(tài)綁定:是很重要的特性,它能使程序變得可擴(kuò)展而不需要重編譯已存代碼。14.final類:為防止他人從你的類上派生新類,此類是不可擴(kuò)展的。15.動(dòng)態(tài)調(diào)用比靜態(tài)調(diào)用花費(fèi)的時(shí)間要長(zhǎng)。16.抽象類:規(guī)定一個(gè)或多個(gè)抽象方法的類本身必須定義為abstract。例::publicabstractstringgetDescripition17.Java中的每一個(gè)類都是從Object類擴(kuò)展而來的。18.object類中的equal和toString方法。equal用于測(cè)試一個(gè)對(duì)象是否同另一個(gè)對(duì)象相等。toString返回一個(gè)代表該對(duì)象的字符串,幾乎每一個(gè)類都會(huì)重載該方法,以便返回當(dāng)前狀態(tài)的正確表示(toString方法是一個(gè)很重要的方法)。19.通用編程:任何類類型的所有值都可以同object類性的變量來代替。20.數(shù)組列表:ArrayList動(dòng)態(tài)數(shù)組列表,是一個(gè)類庫(kù),定義在java.uitl包中,可自動(dòng)調(diào)節(jié)數(shù)組的大小。21.class類object類中的getclass方法返回class類型的一個(gè)實(shí)例,程序啟動(dòng)時(shí)包含在main方法的類會(huì)被加載,虛擬機(jī)要加載他需要的所有類,每一個(gè)加載的類都要加載它需要的類。22.class類為編寫可動(dòng)態(tài)操縱java代碼的程序提供了強(qiáng)大的功能反射,這項(xiàng)功能為JavaBeans特別有用,使用反射Java能支持VB程序員習(xí)慣使用的工具。能夠分析類能力的程序叫反射器,Java中提供此功能的包叫Java.lang.reflect反射機(jī)制十分強(qiáng)大。1)在運(yùn)行時(shí)分析類的能力。2)在運(yùn)行時(shí)探察類的對(duì)象。3)實(shí)現(xiàn)通用數(shù)組操縱代碼。4)提供方法對(duì)象。而此機(jī)制主要針對(duì)是工具者而不是應(yīng)用及程序。反射機(jī)制中的最重要的部分是允許你檢查類的結(jié)構(gòu).用到的API有:java.lang.reflect.Field返回字段。java.reflect.Method返
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 切爾西介紹教學(xué)課件
- 切削三要素培訓(xùn)課件
- 酒店服務(wù)質(zhì)量標(biāo)準(zhǔn)化評(píng)價(jià)表含培訓(xùn)體系
- 北京科技大學(xué)智能科學(xué)與技術(shù)學(xué)院招聘3人完整參考答案詳解
- 蘇教版五年級(jí)語文下冊(cè)《大江保衛(wèi)戰(zhàn)》
- 四年級(jí)下冊(cè)《優(yōu)化-烙餅》教學(xué)設(shè)計(jì)
- 藥理學(xué)入門:甲狀腺癌新藥課件
- 醫(yī)療系統(tǒng)春節(jié)放假前安全教育培訓(xùn)
- 頸部正常軸位CT解剖圖解
- 胎兒電子監(jiān)護(hù)在早產(chǎn)兒管理中的應(yīng)用
- 專題13 三角函數(shù)中的最值模型之胡不歸模型(原卷版)
- 門診藥房西藥管理制度
- 新能源汽車生產(chǎn)代工合同
- 2025年中煤科工集團(tuán)重慶研究院有限公司招聘筆試參考題庫(kù)含答案解析
- 消防救援預(yù)防職務(wù)犯罪
- 一體化泵站安裝施工方案
- 畜禽糞污資源化利用培訓(xùn)
- 《搶救藥物知識(shí)》課件
- 廣州數(shù)控GSK 980TDc車床CNC使用手冊(cè)
- 校區(qū)打印店合作服務(wù) 投標(biāo)方案(技術(shù)方案)
- 建筑工程咨詢服務(wù)合同(標(biāo)準(zhǔn)版)
評(píng)論
0/150
提交評(píng)論