欢迎来到天天文库
浏览记录
ID:50214212
大小:93.00 KB
页数:21页
时间:2020-03-10
《计算机英语 教学课件 作者 杨芸 主编 杨 蕾 李连弟 副主编unit7.ppt》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、UnitsevenTheJavaLanguageTheJavaLanguageTheJavalanguageisaremarkableexampleofprogramminglanguageevolution.JavabuildsonthefamiliarandusefulfeaturesofC++whileremovingitscomplex,dangerous,andsuperfluouselements.Theresultisalanguagethatissafer,simpler,andeasiertouse.Thefollowingsection
2、sdescribeJavaincontrasttoC++.JavaIsFamiliarandSimpleIfyouhaveeverprogrammedinC++,youwillfindJava’sappealtobeinstantaneous.SinceJava’ssyntaxmirrorsthatofC++,youwillbeabletowriteJavaprogramswithinminutes.Yourfirstprogramswillcomequicklyandeasily,withverylittleprogrammingoverhead.You
3、willhavethefeelingthatyouhaveeliminatedalotofclutterfromyourprogramsandyouwillhave.AllthecrypticheaderfilesandpreprocessorstatementsofandC++aregone.Allthearcane#define1statementsandtypedefs2havebeentakenaway.Youwillnolongerhavetodelvethroughseverallevelsofheaderfilestocorrectlyref
4、erenceAPIcalls.Andnoonewillhavetosuffertofigureouthowtouseyoursoftware.Javaprogramssimplyimportthesoftwarepackagestheyneed.Thesepackagesmaybeinanotherdirectory,onanotherdrive,oronamachineontheothersideoftheInternet.TheJavacompilerandinterpreterfigureoutwhatobjectsarereferencedands
5、upplythenecessarylinkage.JavaIsObject---OrientedIfyouthinkC++isandobject-orientedprogramminglanguage,youareinforabigsurprise.AfterusingJavatowriteafewprograms,you’llgetabetterfeelingforwhatobject-orientedsoftwareisallabout.IknowIdid.Javadealswithclassesandobjects,pureandsimple4.Th
6、eyaren’tjustmoredatastructuresthatareavailabletotheprogrammer---theyarethebasisfortheentireprogramminglanguage.InC++,youcandeclareaclass,butyoudon’thaveto.YoucandeclareassociatedvariablesandusethemwithC-stylefunctions.InJava,classesandobjectsareatthecenterofthelanguage.Everythinge
7、lserevolvesaroundthem.Youcan’tdeclarefunctionsandprocedures.Theydon’texist.Youcan’tusestructures,unions,ortypedefs.They’regone,too.Youeitheruseclassesandobjectsoryoudon’tuseJava.It’sthatsimple.Javaprovidesalltheluxuriesofobject-orientedprogramming:classhierarchy,inheritance,encaps
8、ulation,andpolymorphisminacontext
此文档下载收益归作者所有