java(毕业设计)外文文献原文及译文.docx
- 文档编号:64611
- 上传时间:2022-10-01
- 格式:DOCX
- 页数:6
- 大小:33KB
java(毕业设计)外文文献原文及译文.docx
《java(毕业设计)外文文献原文及译文.docx》由会员分享,可在线阅读,更多相关《java(毕业设计)外文文献原文及译文.docx(6页珍藏版)》请在冰豆网上搜索。
毕业设计说明书
英文文献及中文翻译
学号:
学号:
学生姓名:
学院:
专业:
指导教师:
2014年6月
ThinkinginJava
AlthoughitisbasedonC++,Javaismoreofa“pure”object-orientedlanguage.BothC++andJavaarehybridlanguages,butinJavathedesignersfeltthatthehybridizationwasnotasimportantasitwasinC++.Ahybridlanguageallowsmultipleprogrammingstyles;thereasonC++ishybridistosupportbackwardcompatibilitywiththeClanguage.BecauseC++isasupersetoftheClanguage,itincludesmanyofthatlanguage’sundesirablefeatures,whichcanmakesomeaspectsofC++overlycomplicated.TheJavalanguageassumesthatyouwanttodoonlyobject-orientedprogramming.Thismeansthatbeforeyoucanbeginyoumustshiftyourmindsetintoanobject-orientedworld(unlessit’salreadythere).ThebenefitofthisinitialeffortistheabilitytoprograminalanguagethatissimplertolearnandtousethanmanyotherOOPlanguages.Inthischapterwe’llseethebasiccomponentsofaJavaprogramandwe’lllearnthateverythinginJavaisanobject,evenaJavaprogram.
Eachprogramminglanguagehasitsownmeansofmanipulatingdata.Sometimestheprogrammermustbeconstantlyawareofwhattypeofmanipulationisgoingon.Areyoumanipulatingtheobjectdirectly,orareyoudealingwithsomekindofindirectrepresentation(apointerinCorC++)thatmustbetreatedwithaspecialsyntax?
AllthisissimplifiedinJava.Youtreateverythingasanobject,usingasingleconsistentsyntax.Althoughyoutreateverythingasanobject,theidentifieryoumanipulateisactuallya“reference”toanobject.Youmightimaginethissceneasatelevision(theobject)withyourremotecontrol(thereference).Aslongasyou’reholdingthisreference,youhaveaconnectiontothetelevision,butwhensomeonesays“changethechannel”or“lowerthevolume,”whatyou’remanipulatingisthereference,whichinturnmodifiestheobject.Ifyouwanttomovearoundtheroomandstillcontrolthetelevision,youtaketheremote/referencewithyou,notthetelevision.
Also,theremotecontrolcanstandonitsown,withnotelevision.Thatis,justbecauseyouhaveareferencedoesn’tmeanthere’snecessarilyanobjectconnectedtoit.Soifyouwanttoholdawordorsentence,youcreateaStringreference:
Buthereyou’vecreatedonlythereference,notanobject.Ifyoudecidedtosendamessagetosatthispoint,you’llgetanerror(atruntime)becausesisn’tactuallyattachedtoanything(there’snotelevision).Asaferpractice,then,isalwaystoinitializeareferencewhenyoucreateit.
However,thisusesaspecialJavafeature:
stringscanbeinitializedwithquotedtext.Normally,youmustuseamoregeneraltypeofinitializationforobjects
Whenyoucreateareference,youwanttoconnectitwithanewobject.Youdoso,ingeneral,withthenewkeyword.Thekeywordnewsays,“Makemeanewoneoftheseobjects.”Sointheprecedingexample,youcansay:
Notonlydoesthismean“MakemeanewString,”butitalsogivesinformationabouthowtomaketheStringbysupplyinganinitialcharacterstring.
Ofcourse,Stringisnottheonlytypethatexists.Javacomeswithaplethoraofready-madetypes.What’smoreimportantisthatyoucancreateyourowntypes.Infact,that’sthefundamentalactivityinJavaprogramming,andit’swhatyou’llbelearningaboutintherestofthisbook
It’susefultovisualizesomeaspectsofhowthingsarelaidoutwhiletheprogramisrunning—inparticularhowmemoryisarranged.Therearesixdifferentplacestostoredata:
Registers.Thisisthefasteststoragebecauseitexistsinaplacedifferentfromthatofotherstorage:
insidetheprocessor.However,thenumberofregistersisseverelylimited,soregistersareallocatedbythecompileraccordingtoitsneeds.Youdon’thavedirectcontrol,nordoyouseeanyevidenceinyourprogramsthatregistersevenexist.
Thestack.Thislivesinthegeneralrandom-accessmemory(RAM)area,buthasdirectsupportfromtheprocessorviaitsstackpointer.Thestackpointerismoveddowntocreatenewmemoryandmoveduptoreleasethatmemory.Thisisanextremelyfastandefficientwaytoallocatestorage,secondonlytoregisters.TheJavacompilermustknow,whileitiscreatingtheprogram,theexactsizeandlifetimeofallthedatathatisstoredonthestack,becauseitmustgeneratethecodetomovethestackpointerupanddown.Thisconstraintplaceslimitsontheflexibilityofyourprograms,sowhilesomeJavastorageexistsonthestack—inparticular,objectreferences—Javaobjectsthemselvesarenotplacedonthestack.
Theheap.Thisisageneral-purposepoolofmemory(alsointheRAMarea)wh
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- java 毕业设计 外文 文献 原文 译文