Java外文翻译programminglanguage教程文件文档格式.docx
《Java外文翻译programminglanguage教程文件文档格式.docx》由会员分享,可在线阅读,更多相关《Java外文翻译programminglanguage教程文件文档格式.docx(9页珍藏版)》请在冰豆网上搜索。
![Java外文翻译programminglanguage教程文件文档格式.docx](https://file1.bdocx.com/fileroot1/2022-11/22/cbecf7c8-c1d6-4bce-ae77-2dfdc2bf8af7/cbecf7c8-c1d6-4bce-ae77-2dfdc2bf8af71.gif)
1History
1.1Principles
1.2Versions
2Practices
2.1Javaplatform
2.1.1Implementations
2.1.2Performance
2.2Automaticmemorymanagement
History
Seealso:
Java(softwareplatform)#History
JamesGosling,MikeSheridan,andPatrickNaughtoninitiatedtheJavalanguageprojectinJune1991.[12]Javawasoriginallydesignedforinteractivetelevision,butitwastooadvancedforthedigitalcabletelevisionindustryatthetime.[13]ThelanguagewasinitiallycalledOakafteranoaktreethatstoodoutsideGosling'
soffice;
itwentbythenameGreenlater,andwaslaterrenamedJava,fromJavacoffee,saidtobeconsumedinlargequantitiesbythelanguage'
screators.[14]GoslingaimedtoimplementavirtualmachineandalanguagethathadafamiliarC/C++styleofnotation.[15]
SunMicrosystemsreleasedthefirstpublicimplementationasJava1.0in1995.Itpromised"
WriteOnce,RunAnywhere"
(WORA),providingno-costrun-timesonpopularplatforms.Fairlysecureandfeaturingconfigurablesecurity,itallowednetwork-andfile-accessrestrictions.MajorwebbrowserssoonincorporatedtheabilitytorunJavaappletswithinwebpages,andJavaquicklybecamepopular.WiththeadventofJava2(releasedinitiallyasJ2SE1.2inDecember1998–1999),newversionshadmultipleconfigurationsbuiltfordifferenttypesofplatforms.Forexample,J2EEtargetedenterpriseapplicationsandthegreatlystripped-downversionJ2MEformobileapplications(MobileJava).J2SEdesignatedtheStandardEdition.In2006,formarketingpurposes,SunrenamednewJ2versionsasJavaEE,JavaME,andJavaSE,respectively.
In1997,SunMicrosystemsapproachedtheISO/IECJTC1standardsbodyandlatertheEcmaInternationaltoformalizeJava,butitsoonwithdrewfromtheprocess.[16]Javaremainsadefactostandard,controlledthroughtheJavaCommunityProcess.[17]Atonetime,SunmademostofitsJavaimplementationsavailablewithoutcharge,despitetheirproprietarysoftwarestatus.SungeneratedrevenuefromJavathroughthesellingoflicensesforspecializedproductssuchastheJavaEnterpriseSystem.SundistinguishesbetweenitsSoftwareDevelopmentKit(SDK)andRuntimeEnvironment(JRE)(asubsetoftheSDK);
theprimarydistinctioninvolvestheJRE'
slackofthecompiler,utilityprograms,andheaderfiles.
OnNovember13,2006,SunreleasedmuchofJavaasfreeandopensourcesoftware,(FOSS),underthetermsoftheGNUGeneralPublicLicense(GPL).OnMay8,2007,Sunfinishedtheprocess,makingallofJava'
scorecodeavailableunderfreesoftware/open-sourcedistributionterms,asidefromasmallportionofcodetowhichSundidnotholdthecopyright.[18]
Sun'
svice-presidentRichGreensaidthatSun'
sidealrolewithregardstoJavawasasan"
evangelist."
[19]FollowingOracleCorporation'
sacquisitionofSun
Microsystemsin2009–2010,Oraclehasdescribeditselfasthe"
stewardofJavatechnologywitharelentlesscommitmenttofosteringacommunityofparticipationandtransparency"
.[20]Javasoftwarerunsonlaptopstodatacenters,gameconsolestoscientificsupercomputers.Thereare930millionJavaRuntimeEnvironmentdownloadseachyearand3billionmobilephonesrunJava.[21]OnApril2,2010,JamesGoslingresignedfromOracle.[22]
Principles
TherewerefiveprimarygoalsinthecreationoftheJavalanguage:
[23]
1.Itshouldbe"
simple,object-orientedandfamiliar"
2.Itshouldbe"
robustandsecure"
3.Itshouldbe"
architecture-neutralandportable"
4.Itshouldexecutewith"
highperformance"
5.Itshouldbe"
interpreted,threaded,anddynamic"
Versions
Mainarticle:
Javaversionhistory
MajorreleaseversionsofJava,alongwiththeirreleasedates:
JDK1.0(January23,1996)
JDK1.1(February19,1997)
J2SE1.2(December8,1998)
J2SE1.3(May8,2000)
J2SE1.4(February6,2002)
J2EE5.0(September30,2004)
JavaSE6(December11,2006)
JavaSE7(July28,2011)
Practices
Javaplatform
Mainarticles:
Java(softwareplatform)andJavaVirtualMachine
OnecharacteristicofJavaisportability,whichmeansthatcomputerprogramswrittenintheJavalanguagemustrunsimilarlyonanyhardware/operating-systemplatform.ThisisachievedbycompilingtheJavalanguagecodetoanintermediaterepresentationcalledJavabytecode,insteadofdirectlytoplatform-specificmachinecode.Javabytecodeinstructionsareanalogoustomachinecode,butareintendedtobeinterpretedbyavirtualmachine(VM)writtenspecificallyforthehosthardware.End-userscommonlyuseaJavaRuntimeEnvironment(JRE)installedontheirownmachineforstandaloneJavaapplications,orinaWebbrowserforJavaapplets.
Standardizedlibrariesprovideagenericwaytoaccesshost-specificfeaturessuchasgraphics,threading,andnetworking.
Amajorbenefitofusingbytecodeisporting.However,theoverheadofinterpretationmeansthatinterpretedprogramsalmostalwaysrunmoreslowlythanprogramscompiledtonativeexecutableswould.Just-in-Timecompilerswereintroducedfromanearlystagethatcompilebytecodestomachinecodeduringruntime.
Implementations
SunMicrosystemsofficiallylicensedtheJavaStandardEditionplatformforLinux,[24]MacOSX,[25]andSolaris.InthepastSunlicensedJavatoMicrosoftbutthelicenseexpiredwithoutrenewal.[26]BecauseWindowsdoesnotshipwithaJavasoftwareplatform,anetworkofthird-partyvendorsandlicensees[27]developthemforWindowsandotheroperatingsystem/hardwareplatforms.
strademarklicenseforusageoftheJavabrandinsiststhatallimplementationsbe"
compatible"
.ThisresultedinalegaldisputewithMicrosoftafterSunclaimedthattheMicrosoftimplementationdidnotsupportRMIorJNIandhadaddedplatform-specificfeaturesoftheirown.Sunsuedin1997,andin2001wonasettlementofUS$20million,aswellasacourtorderenforcingthetermsofthelicensefromSun.[28]Asaresult,MicrosoftnolongershipsJavawithWindows,andinrecentversionsofWindows,InternetExplorercannotsupportJavaappletswithoutathird-partyplugin.Sun,andothers,havemadeavailablefreeJavarun-timesystemsforthoseandotherversionsofWindows.
Platform-independentJavaisessentialtotheJavaEEstrategy,andanevenmorerigorousvalidationisrequiredtocertifyanimplementation.Thisenvironmentenablesportableserver-sideapplications,suchasWebservices,JavaServlets,andEnterpriseJavaBeans,aswellaswithembeddedsystemsbasedonOSGi,usingEmbeddedJavaenvironments.ThroughtheGlassFishproject,Sunisworkingtocreateafullyfunctional,unifiedopensourceimplementationoftheJavaEEtechnologies.
SunalsodistributesasupersetoftheJREcalledtheJavaDevelopmentKit(commonlyknownastheJDK),whichincludesdevelopmenttoolssuchastheJavacompiler,Javadoc,Jar,anddebugger.
Performance
Javaperformance
ProgramswritteninJavahaveareputationforbeingslowerandrequiringmorememorythanthosewritteninC.[29]However,Javaprograms'
executionspeedimprovedsignificantlywiththeintroductionofJust-in-timecompilationin1997/1998forJava1.1,[30]theadditionoflanguagefeaturessupportingbettercodeanalysis(suchasinnerclasses,StringBufferclass,optionalassertions,etc.),andoptimizationsintheJavaVirtualMachineitself,suchasHotSpotbecomingthedefaultforSun'
sJVMin2000.Currently(November2011),Java2.0codehasapproximatelyhalftheperformanceofCcode.[31]
SomeplatformsofferdirecthardwaresupportforJava;
therearemicrocontrollersthatcanrunJavainhardwareinsteadofasoftwareJVM,andARMbasedprocessorscanhavehardwaresupportforexecutingJavabytecodethroughitsJazelleoption.
Automaticmemorymanagement
Javausesanautomaticgarbagecollectortomanagememoryintheobjectlifecycle.Theprogrammerdetermineswhenobjectsarecreated,andtheJavaruntimeisresponsibleforrecoveringthememoryonceobjectsarenolongerinuse.Oncenoreferencestoanobjectremain,theunreachablememorybecomeseligibletobefreedautomaticallybythegarbagecollector.Somethingsimilartoamemoryleakmaystilloccurifaprogrammer'
scodeholdsareferencetoanobjectthatisnolongerneeded,typicallywhenobjectsthatarenolongerneededarestoredincontainersthatarestillinuse.Ifme