0% found this document useful (0 votes)
106 views19 pages

Java (Programming Language)

Java is a general-purpose programming language that is concurrent, class-based, object-oriented and designed to have few implementation dependencies. It allows applications to write once and run anywhere on any platform that supports Java without recompilation. Java code is compiled to bytecode that runs on a Java virtual machine, making it portable across architectures. It was created in the early 1990s by James Gosling at Sun Microsystems.

Uploaded by

maomedalid
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
106 views19 pages

Java (Programming Language)

Java is a general-purpose programming language that is concurrent, class-based, object-oriented and designed to have few implementation dependencies. It allows applications to write once and run anywhere on any platform that supports Java without recompilation. Java code is compiled to bytecode that runs on a Java virtual machine, making it portable across architectures. It was created in the early 1990s by James Gosling at Sun Microsystems.

Uploaded by

maomedalid
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 19

Java(programminglanguage)

FromWikipedia,thefreeencyclopedia

Javaisageneralpurposecomputerprogramming
languagethatisconcurrent,classbased,object
oriented,[14]andspecificallydesignedtohaveasfew
implementationdependenciesaspossible.Itisintended
toletapplicationdevelopers"writeonce,runanywhere"
(WORA),[15]meaningthatcompiledJavacodecanrun
onallplatformsthatsupportJavawithouttheneedfor
recompilation.[16]Javaapplicationsaretypically
compiledtobytecodethatcanrunonanyJavavirtual
machine(JVM)regardlessofcomputerarchitecture.As
of2016,Javaisoneofthemostpopularprogramming
languagesinuse,[17][18][19][20]particularlyforclient
serverwebapplications,withareported9million
developers.JavawasoriginallydevelopedbyJames
GoslingatSunMicrosystems(whichhassincebeen
acquiredbyOracleCorporation)andreleasedin1995as
acorecomponentofSunMicrosystems'Javaplatform.
ThelanguagederivesmuchofitssyntaxfromCand
C++,butithasfewerlowlevelfacilitiesthaneitherof
them.
TheoriginalandreferenceimplementationJava
compilers,virtualmachines,andclasslibrarieswere
originallyreleasedbySununderproprietarylicences.As
ofMay2007,incompliancewiththespecificationsofthe
JavaCommunityProcess,SunrelicensedmostofitsJava
technologiesundertheGNUGeneralPublicLicense.
Othershavealsodevelopedalternativeimplementations
oftheseSuntechnologies,suchastheGNUCompilerfor
Java(bytecodecompiler),GNUClasspath(standard
libraries),andIcedTeaWeb(browserpluginforapplets).
ThelatestversionisJava8,whichistheonlyversion
currentlysupportedforfreebyOracle,althoughearlier
versionsaresupportedbothbyOracleandother
companiesonacommercialbasis.

Java

Paradigm

Multiparadigm:Objectoriented
(classbased),structured,
imperative,generic,reflective,
concurrent

Designedby

JamesGosling

Developer

SunMicrosystems(nowacquired
byOracleCorporation)

Firstappeared May23,1995[1]
Typing
discipline

Static,strong,safe,nominative,
manifest

License

GNUGeneralPublicLicense,Java
CommunityProcess

Filename
extensions

.java,.class,.jar

Website

java.net(http://java.net)
Majorimplementations

OpenJDK,GNUCompilerforJava(GCJ),many
others

Contents
1 History
1.1 Principles
1.2 Versions
2 Practices

Dialects
GenericJava,Pizza
Influencedby

2 Practices
2.1 Javaplatform
2.1.1 Implementations
2.1.2 Performance
2.2 Automaticmemorymanagement
3 Syntax
4 Examples
4.1 "Hello,world!"program
4.2 Comprehensiveexample
5 Specialclasses
5.1 Applet
5.2 Servlet
5.3 JavaServerPages
5.4 Swingapplication
5.5 Generics
6 Criticism
7 Useonunofficialsoftwareplatforms
7.1 Google
8 Classlibraries
9 Documentation
10 Editions
11 Seealso
11.1 ComparisonofJavawithother
languages
12 Notes
13 References
14 Externallinks

Ada83,C++, [2]C#, [3]Eiffel, [4]GenericJava,


Mesa, [5]Modula3, [6]Oberon, [7]ObjectiveC, [8]
UCSDPascal, [9][10]ObjectPascal[11]
Influenced
Ada2005,BeanShell,C#,Chapel, [12]Clojure,
ECMAScript,Fantom,Groovy,Hack, [13]Haxe,J#,
JavaScript,Kotlin,PHP,Python,Scala,Seed7,
Vala
JavaProgrammingatWikibooks

History
JamesGosling,MikeSheridan,andPatrickNaughtoninitiatedtheJavalanguageprojectinJune1991.[21]
Javawasoriginallydesignedforinteractivetelevision,butitwastooadvancedforthedigitalcable
televisionindustryatthetime.[22]ThelanguagewasinitiallycalledOakafteranoaktreethatstoodoutside
Gosling'soffice.LatertheprojectwentbythenameGreenandwasfinallyrenamedJava,fromJava
coffee.[23]GoslingdesignedJavawithaC/C++stylesyntaxthatsystemandapplicationprogrammers
wouldfindfamiliar.[24]
SunMicrosystemsreleasedthefirstpublicimplementationasJava1.0in1995.[25]Itpromised"WriteOnce,
RunAnywhere"(WORA),providingnocostruntimesonpopularplatforms.Fairlysecureandfeaturing
configurablesecurity,itallowednetworkandfileaccessrestrictions.Majorwebbrowserssoon
incorporatedtheabilitytorunJavaappletswithinwebpages,andJavaquicklybecamepopular,while
mostlyoutsideofbrowsers,thatwasn'ttheoriginalplan.InJanuary2016,OracleannouncedthatJava
runtimeenvironmentsbasedonJDK9willdiscontinuethebrowserplugin.[26]TheJava1.0compilerwas
rewritteninJavabyArthurvanHofftocomplystrictlywiththeJava1.0languagespecification.[27]With
theadventofJava2(releasedinitiallyasJ2SE1.2inDecember19981999),newversionshadmultiple
configurationsbuiltfordifferenttypesofplatforms.J2EEincludedtechnologiesandAPIsforenterprise

applicationstypicallyruninserverenvironments,whileJ2MEfeatured
APIsoptimizedformobileapplications.Thedesktopversionwasrenamed
J2SE.In2006,formarketingpurposes,SunrenamednewJ2versionsas
JavaEE,JavaME,andJavaSE,respectively.
In1997,SunMicrosystemsapproachedtheISO/IECJTC1standardsbody
andlatertheEcmaInternationaltoformalizeJava,butitsoonwithdrew
fromtheprocess.[28][29][30]Javaremainsadefactostandard,controlled
throughtheJavaCommunityProcess.[31]Atonetime,Sunmademostofits
Javaimplementationsavailablewithoutcharge,despitetheirproprietary
softwarestatus.SungeneratedrevenuefromJavathroughthesellingof
licensesforspecializedproductssuchastheJavaEnterpriseSystem.
OnNovember13,2006,SunreleasedmuchofitsJavavirtualmachine
(JVM)asfreeandopensourcesoftware,(FOSS),underthetermsofthe
GNUGeneralPublicLicense(GPL).OnMay8,2007,Sunfinishedthe
process,makingallofitsJVM'scorecodeavailableunderfree
software/opensourcedistributionterms,asidefromasmallportionofcode
towhichSundidnotholdthecopyright.[32]
Sun'svicepresidentRichGreensaidthatSun'sidealrolewith
regardtoJavawasasan"evangelist".[33]FollowingOracle
Corporation'sacquisitionofSunMicrosystemsin200910,Oracle
hasdescribeditselfasthe"stewardofJavatechnologywitha
relentlesscommitmenttofosteringacommunityofparticipationand
transparency".[34]ThisdidnotpreventOraclefromfilingalawsuit
againstGoogleshortlyafterthatforusingJavainsidetheAndroid
SDK(seeGooglesectionbelow).Javasoftwarerunsoneverything
fromlaptopstodatacenters,gameconsolestoscientific
supercomputers.[35]OnApril2,2010,JamesGoslingresignedfrom
Oracle.[36]

Principles

Duke,theJavamascot

JamesGosling,thecreatorofJava
(2008)

TherewerefiveprimarygoalsinthecreationoftheJavalanguage:[16]
1.Itmustbe"simple,objectoriented,andfamiliar".
2.Itmustbe"robustandsecure".
3.Itmustbe"architectureneutralandportable".
4.Itmustexecutewith"highperformance".
5.Itmustbe"interpreted,threaded,anddynamic".

Versions
Asof2015,onlyJava8issupported("publicly").MajorreleaseversionsofJava,alongwiththeirrelease
dates:

JDK1.0(January21,1996)
JDK1.1(February19,1997)
J2SE1.2(December8,1998)
J2SE1.3(May8,2000)
J2SE1.4(February6,2002)
J2SE5.0(September30,2004)
JavaSE6(December11,2006)
JavaSE7(July28,2011)
JavaSE8(March18,2014)

Practices
Javaplatform

TheTIOBEprogramminglanguage
popularityindexgraphfrom2002to
2015.Overthecourseofadecade
Java(blue)andC(black)competing
forthetopposition.

OnedesigngoalofJavaisportability,whichmeansthatprograms
writtenfortheJavaplatformmustrunsimilarlyonanycombination
ofhardwareandoperatingsystemwithadequateruntimesupport.
ThisisachievedbycompilingtheJavalanguagecodetoan
intermediaterepresentationcalledJavabytecode,insteadofdirectly
toarchitecturespecificmachinecode.Javabytecodeinstructionsare
analogoustomachinecode,buttheyareintendedtobeexecutedby
avirtualmachine(VM)writtenspecificallyforthehosthardware.
EnduserscommonlyuseaJavaRuntimeEnvironment(JRE)
installedontheirownmachineforstandaloneJavaapplications,or
inawebbrowserforJavaapplets.
Standardlibrariesprovideagenericwaytoaccesshostspecific
featuressuchasgraphics,threading,andnetworking.

JavaControlPanel,version7

Theuseofuniversalbytecodemakesportingsimple.However,the
overheadofinterpretingbytecodeintomachineinstructionsmakesinterpretedprogramsalmostalwaysrun
moreslowlythannativeexecutables.However,justintime(JIT)compilersthatcompilebytecodesto
machinecodeduringruntimewereintroducedfromanearlystage.Javaitselfisplatformindependent,and
isadaptedtotheparticularplatformitistorunonbyaJavavirtualmachineforit,whichtranslatestheJava
bytecodeintotheplatform'smachinelanguage.[37]
Implementations
OracleCorporationisthecurrentowneroftheofficialimplementationoftheJavaSEplatform,following
theiracquisitionofSunMicrosystemsonJanuary27,2010.Thisimplementationisbasedontheoriginal
implementationofJavabySun.TheOracleimplementationisavailableforMicrosoftWindows(stillworks
forXP,whileonlylaterversionscurrently"publicly"supported),MacOSX,LinuxandSolaris.Because
JavalacksanyformalstandardizationrecognizedbyEcmaInternational,ISO/IEC,ANSI,orotherthird
partystandardsorganization,theOracleimplementationisthedefactostandard.
TheOracleimplementationispackagedintotwodifferentdistributions:TheJavaRuntimeEnvironment
(JRE)whichcontainsthepartsoftheJavaSEplatformrequiredtorunJavaprogramsandisintendedfor
endusers,andtheJavaDevelopmentKit(JDK),whichisintendedforsoftwaredevelopersandincludes

developmenttoolssuchastheJavacompiler,Javadoc,Jar,andadebugger.
OpenJDKisanothernotableJavaSEimplementationthatislicensedundertheGNUGPL.The
implementationstartedwhenSunbeganreleasingtheJavasourcecodeundertheGPL.AsofJavaSE7,
OpenJDKistheofficialJavareferenceimplementation.
ThegoalofJavaistomakeallimplementationsofJavacompatible.Historically,Sun'strademarklicense
forusageoftheJavabrandinsiststhatallimplementationsbe"compatible".Thisresultedinalegaldispute
withMicrosoftafterSunclaimedthattheMicrosoftimplementationdidnotsupportRMIorJNIandhad
addedplatformspecificfeaturesoftheirown.Sunsuedin1997,andin2001wonasettlementofUS$20
million,aswellasacourtorderenforcingthetermsofthelicensefromSun.[38]Asaresult,Microsoftno
longershipsJavawithWindows.
PlatformindependentJavaisessentialtoJavaEE,andanevenmorerigorousvalidationisrequiredto
certifyanimplementation.Thisenvironmentenablesportableserversideapplications.
Performance
ProgramswritteninJavahaveareputationforbeingslowerandrequiringmorememorythanthosewritten
inC++.[39][40]However,Javaprograms'executionspeedimprovedsignificantlywiththeintroductionof
justintimecompilationin1997/1998forJava1.1,[41]theadditionoflanguagefeaturessupportingbetter
codeanalysis(suchasinnerclasses,theStringBuilderclass,optionalassertions,etc.),andoptimizationsin
theJavavirtualmachine,suchasHotSpotbecomingthedefaultforSun'sJVMin2000.WithJava1.5,the
performancewasimprovedwiththeadditionofthejava.util.concurrentpackage,includingLockfree
implementationsoftheConcurrentMapsandothermulticorecollections,anditwasimprovedfurtherJava
1.6.
SomeplatformsofferdirecthardwaresupportforJavatherearemicrocontrollersthatcanrunJavain
hardwareinsteadofasoftwareJavavirtualmachine,andARMbasedprocessorscanhavehardwaresupport
forexecutingJavabytecodethroughtheirJazelleoption(whileitssupportismostlydroppedincurrent
implementationsofARM).

Automaticmemorymanagement
Javausesanautomaticgarbagecollectortomanagememoryintheobjectlifecycle.Theprogrammer
determineswhenobjectsarecreated,andtheJavaruntimeisresponsibleforrecoveringthememoryonce
objectsarenolongerinuse.Oncenoreferencestoanobjectremain,theunreachablememorybecomes
eligibletobefreedautomaticallybythegarbagecollector.Somethingsimilartoamemoryleakmaystill
occurifaprogrammer'scodeholdsareferencetoanobjectthatisnolongerneeded,typicallywhenobjects
thatarenolongerneededarestoredincontainersthatarestillinuse.Ifmethodsforanonexistentobjectare
called,a"nullpointerexception"isthrown.[42][43]
OneoftheideasbehindJava'sautomaticmemorymanagementmodelisthatprogrammerscanbespared
theburdenofhavingtoperformmanualmemorymanagement.Insomelanguages,memoryforthecreation
ofobjectsisimplicitlyallocatedonthestack,orexplicitlyallocatedanddeallocatedfromtheheap.Inthe
lattercasetheresponsibilityofmanagingmemoryresideswiththeprogrammer.Iftheprogramdoesnot
deallocateanobject,amemoryleakoccurs.Iftheprogramattemptstoaccessordeallocatememorythathas

alreadybeendeallocated,theresultisundefinedanddifficulttopredict,andtheprogramislikelyto
becomeunstableand/orcrash.Thiscanbepartiallyremediedbytheuseofsmartpointers,buttheseadd
overheadandcomplexity.Notethatgarbagecollectiondoesnotprevent"logical"memoryleaks,i.e.,those
wherethememoryisstillreferencedbutneverused.
Garbagecollectionmayhappenatanytime.Ideally,itwilloccurwhenaprogramisidle.Itisguaranteedto
betriggeredifthereisinsufficientfreememoryontheheaptoallocateanewobjectthiscancausea
programtostallmomentarily.ExplicitmemorymanagementisnotpossibleinJava.
JavadoesnotsupportC/C++stylepointerarithmetic,whereobjectaddressesandunsignedintegers(usually
longintegers)canbeusedinterchangeably.Thisallowsthegarbagecollectortorelocatereferencedobjects
andensurestypesafetyandsecurity.
AsinC++andsomeotherobjectorientedlanguages,variablesofJava'sprimitivedatatypesareeither
storeddirectlyinfields(forobjects)oronthestack(formethods)ratherthanontheheap,asiscommonly
truefornonprimitivedatatypes(butseeescapeanalysis).ThiswasaconsciousdecisionbyJava's
designersforperformancereasons.
Javacontainsmultipletypesofgarbagecollectors.Bydefault,HotSpotusestheparallelscavengegarbage
collector.However,therearealsoseveralothergarbagecollectorsthatcanbeusedtomanagetheheap.For
90%ofapplicationsinJava,theConcurrentMarkSweep(CMS)garbagecollectorissufficient.[44]Oracle
aimstoreplaceCMSwiththeGarbageFirstcollector(G1).[45]

Syntax
ThesyntaxofJavaislargelyinfluencedbyC++.UnlikeC++,whichcombinesthesyntaxforstructured,
generic,andobjectorientedprogramming,Javawasbuiltalmostexclusivelyasanobjectoriented
language.[16]Allcodeiswritteninsideclasses,andeverydataitemisanobject,withtheexceptionofthe
primitivedatatypes,i.e.integers,floatingpointnumbers,booleanvalues,andcharacters,whicharenot
objectsforperformancereasons.JavareusessomepopularaspectsofC++(suchasprintf()method).
UnlikeC++,Javadoesnotsupportoperatoroverloading[46]ormultipleinheritanceforclasses,though
multipleinheritanceissupportedforinterfaces.[47]Thissimplifiesthelanguageandaidsinpreventing
potentialerrorsandantipatterndesign.
JavausescommentssimilartothoseofC++.Therearethreedifferentstylesofcomments:asingleline
stylemarkedwithtwoslashes(//),amultiplelinestyleopenedwith/*andclosedwith*/,andtheJavadoc
commentingstyleopenedwith/**andclosedwith*/.TheJavadocstyleofcommentingallowstheuserto
runtheJavadocexecutabletocreatedocumentationfortheprogram.
Example:
//Thisisanexampleofasinglelinecommentusingtwoslashes
/*Thisisanexampleofamultiplelinecommentusingtheslashandasterisk.
Thistypeofcommentcanbeusedtoholdalotofinformationordeactivate
code,butitisveryimportanttoremembertoclosethecomment.*/
packagefibsandlies;

importjava.util.HashMap;
/**
*ThisisanexampleofaJavadoccomment;Javadoccancompiledocumentation
*fromthistext.Javadoccommentsmustimmediatelyprecedetheclass,method,orfieldbeingdocumented.
*/
publicclassFibCalculatorextendsFibonacciimplementsCalculator{
privatestaticMap<Integer,Integer>memoized=newHashMap<Integer,Integer>();
/*
*ThemainmethodwrittenasfollowsisusedbytheJVMasastartingpointfortheprogram.
*/
publicstaticvoidmain(String[]args){
memoized.put(1,1);
memoized.put(2,1);
System.out.println(fibonacci(12));//Getthe12thFibonaccinumberandprinttoconsole
}
/**
*AnexampleofamethodwritteninJava,wrappedinaclass.
*GivenanonnegativenumberFIBINDEX,returns
*theNthFibonaccinumber,whereNequalsFIBINDEX.
*@paramfibIndexTheindexoftheFibonaccinumber
*@returnTheFibonaccinumber
*/
publicstaticintfibonacci(intfibIndex){
if(memoized.containsKey(fibIndex)){
returnmemoized.get(fibIndex);
}else{
intanswer=fibonacci(fibIndex1)+fibonacci(fibIndex2);
memoized.put(fibIndex,answer);
returnanswer;
}
}
}

Examples
"Hello,world!"program
Thetraditional"Hello,world!"programcanbewritteninJavaas:[48]
classHelloWorldApp{
publicstaticvoidmain(String[]args){
System.out.println("HelloWorld!");//Printsthestringtotheconsole.
}
}

Sourcefilesmustbenamedafterthepublicclasstheycontain,appendingthesuffix.java,forexample,
HelloWorldApp.java.Itmustfirstbecompiledintobytecode,usingaJavacompiler,producingafilenamed
HelloWorldApp.class.Onlythencanitbeexecuted,or"launched".TheJavasourcefilemayonlycontain
onepublicclass,butitcancontainmultipleclasseswithotherthanpublicaccessandanynumberofpublic
innerclasses.Whenthesourcefilecontainsmultipleclasses,makeoneclass"public"andnamethesource
filewiththatpublicclassname.
Aclassthatisnotdeclaredpublicmaybestoredinany.javafile.Thecompilerwillgenerateaclassfile
foreachclassdefinedinthesourcefile.Thenameoftheclassfileisthenameoftheclass,with.class
appended.Forclassfilegeneration,anonymousclassesaretreatedasiftheirnameweretheconcatenation

ofthenameoftheirenclosingclass,a$,andaninteger.
Thekeywordpublicdenotesthatamethodcanbecalledfromcodeinotherclasses,orthataclassmaybe
usedbyclassesoutsidetheclasshierarchy.Theclasshierarchyisrelatedtothenameofthedirectoryin
whichthe.javafileislocated.Thisiscalledanaccesslevelmodifier.Otheraccesslevelmodifiersinclude
thekeywordsprivateandprotected.
Thekeywordstaticinfrontofamethodindicatesastaticmethod,whichisassociatedonlywiththeclass
andnotwithanyspecificinstanceofthatclass.Onlystaticmethodscanbeinvokedwithoutareferenceto
anobject.Staticmethodscannotaccessanyclassmembersthatarenotalsostatic.Methodsthatarenot
designatedstaticareinstancemethods,andrequireaspecificinstanceofaclasstooperate.
Thekeywordvoidindicatesthatthemainmethoddoesnotreturnanyvaluetothecaller.IfaJavaprogram
istoexitwithanerrorcode,itmustcallSystem.exit()explicitly.
Themethodname"main"isnotakeywordintheJavalanguage.Itissimplythenameofthemethodthe
Javalaunchercallstopasscontroltotheprogram.Javaclassesthatruninmanagedenvironmentssuchas
appletsandEnterpriseJavaBeansdonotuseorneedamain()method.AJavaprogrammaycontain
multipleclassesthathavemainmethods,whichmeansthattheVMneedstobeexplicitlytoldwhichclassto
launchfrom.
ThemainmethodmustacceptanarrayofString(https://docs.oracle.com/javase/8/docs/api/java/lan
g/String.html)objects.Byconvention,itisreferencedasargsalthoughanyotherlegalidentifiernamecan
beused.SinceJava5,themainmethodcanalsousevariablearguments,intheformofpublicstaticvoid
main(String...args),allowingthemainmethodtobeinvokedwithanarbitrarynumberofString
arguments.Theeffectofthisalternatedeclarationissemanticallyidentical(theargsparameterisstillan
arrayofStringobjects),butitallowsanalternativesyntaxforcreatingandpassingthearray.
TheJavalauncherlaunchesJavabyloadingagivenclass(specifiedonthecommandlineorasanattribute
inaJAR)andstartingitspublicstaticvoidmain(String[])method.Standaloneprogramsmustdeclare
thismethodexplicitly.TheString[]argsparameterisanarrayofString(https://docs.oracle.com/javas
e/8/docs/api/java/lang/String.html)objectscontaininganyargumentspassedtotheclass.The
parameterstomainareoftenpassedbymeansofacommandline.
PrintingispartofaJavastandardlibrary:TheSystem(https://docs.oracle.com/javase/8/docs/api/java/
lang/System.html)classdefinesapublicstaticfieldcalledout(https://docs.oracle.com/javase/8/docs/
api/java/lang/System.html#out).TheoutobjectisaninstanceofthePrintStream(https://docs.oracle.
com/javase/8/docs/api/java/io/PrintStream.html)classandprovidesmanymethodsforprintingdatato
standardout,includingprintln(String)(https://docs.oracle.com/javase/8/docs/api/java/io/PrintStr
eam.html#println(java.lang.String))whichalsoappendsanewlinetothepassedstring.
Thestring"HelloWorld!"isautomaticallyconvertedtoaStringobjectbythecompiler.

Comprehensiveexample
//OddEven.java
importjavax.swing.JOptionPane;

publicclassOddEven{
privateintuserInput;//awholenumber("int"meansinteger)
/**
*Thisistheconstructormethod.ItgetscalledwhenanobjectoftheOddEventype
*isbeingcreated.
*/
publicOddEven(){
/*
*InmostJavaprogramsconstructorscaninitializeobjectswithdefaultvalues,orcreate
*otherobjectsthatthisobjectmightusetoperformitsfunctions.InsomeJavaprograms,the
*constructormaysimplybeanemptyfunctionifnothingneedstobeinitializedpriortothe
*functioningoftheobject.Inthisprogram'scase,anemptyconstructorwouldsuffice.
*Aconstructormustexist;however,iftheuserdoesn'tputoneinthenthecompiler
*willcreateanemptyone.
*/
}
/**
*Thisisthemainmethod.ItgetscalledwhenthisclassisrunthroughaJavainterpreter.
*@paramargscommandlinearguments(unused)
*/
publicstaticvoidmain(finalString[]args){
/*
*Thislineofcodecreatesanewinstanceofthisclasscalled"number"(alsoknownasan
*Object)andinitializesitbycallingtheconstructor.Thenextlineofcodecalls
*the"showDialog()"method,whichbringsupaprompttoaskyouforanumber.
*/
OddEvennumber=newOddEven();
number.showDialog();
}
publicvoidshowDialog(){
/*
*"try"makessurenothinggoeswrong.Ifsomethingdoes,
*theinterpreterskipsto"catch"toseewhatitshoulddo.
*/
try{
/*
*ThecodebelowbringsupaJOptionPane,whichisadialogbox
*TheStringreturnedbythe"showInputDialog()"methodisconvertedinto
*aninteger,makingtheprogramtreatitasanumberinsteadofaword.
*Afterthat,thismethodcallsasecondmethod,calculate()thatwill
*displayeither"Even"or"Odd."
*/
userInput=Integer.parseInt(JOptionPane.showInputDialog("Pleaseenteranumber."));
calculate();
}catch(finalNumberFormatExceptione){
/*
*Gettinginthecatchblockmeansthattherewasaproblemwiththeformatof
*thenumber.Probablysomelettersweretypedininsteadofanumber.
*/
System.err.println("ERROR:Invalidinput.Pleasetypeinanumericalvalue.");
}
}
/**
*Whenthisgetscalled,itsendsamessagetotheinterpreter.
*Theinterpreterusuallyshowsitonthecommandprompt(ForWindowsusers)
*ortheterminal(For*nixusers).(Assumingit'sopen)
*/
privatevoidcalculate(){
if((userInput%2)==0){
JOptionPane.showMessageDialog(null,"Even");
}else{
JOptionPane.showMessageDialog(null,"Odd");
}
}
}

TheimportstatementimportstheJOptionPane(https://docs.oracle.com/javase/8/docs/api/java
x/swing/JOptionPane.html)classfromthejavax.swing(https://docs.oracle.com/javase/8/docs/a
pi/javax/swing/packagesummary.html)package.
TheOddEvenclassdeclaresasingleprivatefieldoftypeintnameduserInput.Everyinstanceofthe
OddEvenclasshasitsowncopyoftheuserInputfield.Theprivatedeclarationmeansthatnoother
classcanaccess(readorwrite)theuserInputfield.
OddEven()isapublicconstructor.Constructorshavethesamenameastheenclosingclasstheyare
declaredin,andunlikeamethod,havenoreturntype.Aconstructorisusedtoinitializeanobjectthat
isanewlycreatedinstanceoftheclass.
Thecalculate()methodisdeclaredwithoutthestatickeyword.Thismeansthatthemethodis
invokedusingaspecificinstanceoftheOddEvenclass.(Thereferenceusedtoinvokethemethodis
passedasanundeclaredparameteroftypeOddEvennamedthis.)Themethodteststheexpression
userInput%2==0usingtheifkeywordtoseeiftheremainderofdividingtheuserInputfield
belongingtotheinstanceoftheclassbytwoiszero.Ifthisexpressionistrue,thenitprintsEvenif
thisexpressionisfalseitprintsOdd.(Thecalculatemethodcanbeequivalentlyaccessedas
this.calculateandtheuserInputfieldcanbeequivalentlyaccessedasthis.userInput,whichboth
explicitlyusetheundeclaredthisparameter.)
OddEvennumber=newOddEven();declaresalocalobjectreferencevariableinthemainmethod
namednumber.ThisvariablecanholdareferencetoanobjectoftypeOddEven.Thedeclaration
initializesnumberbyfirstcreatinganinstanceoftheOddEvenclass,usingthenewkeywordandthe
OddEven()constructor,andthenassigningthisinstancetothevariable.
Thestatementnumber.showDialog();callsthecalculatemethod.TheinstanceofOddEvenobject
referencedbythenumberlocalvariableisusedtoinvokethemethodandpassedastheundeclared
thisparametertothecalculatemethod.
userInput=Integer.parseInt(JOptionPane.showInputDialog("PleaseEnterANumber"));isa
statementthatconvertsthetypeofStringtotheprimitivedatatypeintbyusingautilityfunctionin
theprimitivewrapperclassInteger.

Specialclasses
Applet
Javaappletsareprogramsthatareembeddedinotherapplications,typicallyinaWebpagedisplayedina
webbrowser.
//Hello.java
importjavax.swing.JApplet;
importjava.awt.Graphics;
publicclassHelloextendsJApplet{
publicvoidpaintComponent(finalGraphicsg){
g.drawString("Hello,world!",65,95);
}
}

TheimportstatementsdirecttheJavacompilertoincludethejavax.swing.JApplet(https://docs.oracle.
com/javase/8/docs/api/javax/swing/JApplet.html)andjava.awt.Graphics(https://docs.oracle.com/ja
vase/8/docs/api/java/awt/Graphics.html)classesinthecompilation.Theimportstatementallowsthese

classestobereferencedinthesourcecodeusingthesimpleclassname(i.e.JApplet)insteadofthefully
qualifiedclassname(FQCN,i.e.javax.swing.JApplet).
TheHelloclassextends(subclasses)theJApplet(JavaApplet)classtheJAppletclassprovidesthe
frameworkforthehostapplicationtodisplayandcontrolthelifecycleoftheapplet.TheJAppletclassisa
JComponent(JavaGraphicalComponent)whichprovidestheappletwiththecapabilitytodisplaya
graphicaluserinterface(GUI)andrespondtouserevents.
TheHelloclassoverridesthepaintComponent(Graphics)(https://docs.oracle.com/javase/8/docs/api/ja
va/awt/Container.html#paint(java.awt.Graphics))method(additionallyindicatedwiththeannotation,
supportedasofJDK1.5,Override)inheritedfromtheContainer(https://docs.oracle.com/javase/8/doc
s/api/java/awt/Container.html)superclasstoprovidethecodetodisplaytheapplet.The
paintComponent()methodispassedaGraphicsobjectthatcontainsthegraphiccontextusedtodisplaythe
applet.ThepaintComponent()methodcallsthegraphiccontextdrawString(String,int,int)(https://do
cs.oracle.com/javase/8/docs/api/java/awt/Graphics.html#drawString(java.lang.String,%20int,%20in
t))methodtodisplaythe"Hello,world!"stringatapixeloffsetof(65,95)fromtheupperleftcornerin

theapplet'sdisplay.
<!DOCTYPEHTMLPUBLIC"//W3C//DTDHTML4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<!Hello.html>
<html>
<head>
<title>HelloWorldApplet</title>
</head>
<body>
<appletcode="Hello.class"width="200"height="200">
</applet>
</body>
</html>

AnappletisplacedinanHTMLdocumentusingthe<applet>HTMLelement.Theapplettaghasthree
attributesset:code="Hello"specifiesthenameoftheJAppletclassandwidth="200"height="200"setsthe
pixelwidthandheightoftheapplet.AppletsmayalsobeembeddedinHTMLusingeithertheobjector
embedelement,[49]althoughsupportfortheseelementsbywebbrowsersisinconsistent.[50]However,the
applettagisdeprecated,sotheobjecttagispreferredwheresupported.

Thehostapplication,typicallyaWebbrowser,instantiatestheHelloappletandcreatesanAppletContext(h
ttps://docs.oracle.com/javase/8/docs/api/java/applet/AppletContext.html)fortheapplet.Oncethe
applethasinitializeditself,itisaddedtotheAWTdisplayhierarchy.ThepaintComponent()methodis
calledbytheAWTeventdispatchingthreadwheneverthedisplayneedstheapplettodrawitself.

Servlet
JavaServlettechnologyprovidesWebdeveloperswithasimple,consistentmechanismforextendingthe
functionalityofaWebserverandforaccessingexistingbusinesssystems.ServletsareserversideJavaEE
componentsthatgenerateresponses(typicallyHTMLpages)torequests(typicallyHTTPrequests)from
clients.Aservletcanalmostbethoughtofasanappletthatrunsontheserversidewithoutaface.
//Hello.java

importjava.io.*;
importjavax.servlet.*;
publicclassHelloextendsGenericServlet{
publicvoidservice(finalServletRequestrequest,finalServletResponseresponse)
throwsServletException,IOException{
response.setContentType("text/html");
finalPrintWriterpw=response.getWriter();
try{
pw.println("Hello,world!");
}finally{
pw.close();
}
}
}

TheimportstatementsdirecttheJavacompilertoincludeallthepublicclassesandinterfacesfromthe
java.io(https://docs.oracle.com/javase/8/docs/api/java/io/packagesummary.html)and
javax.servlet(https://docs.oracle.com/javaee/7/api/javax/servlet/packagesummary.html)packages
inthecompilation.PackagesmakeJavawellsuitedforlargescaleapplications.
TheHelloclassextendstheGenericServlet(https://docs.oracle.com/javaee/7/api/javax/servlet/Gene
ricServlet.html)classtheGenericServletclassprovidestheinterfacefortheservertoforwardrequeststo
theservletandcontroltheservlet'slifecycle.
TheHelloclassoverridestheservice(ServletRequest,ServletResponse)(https://docs.oracle.com/java
ee/7/api/javax/servlet/Servlet.html#service(javax.servlet.ServletRequest,javax.servlet.ServletRe
sponse))methoddefinedbytheServlet(https://docs.oracle.com/javaee/7/api/javax/servlet/Servle
t.html)interfacetoprovidethecodefortheservicerequesthandler.Theservice()methodispassed:a
ServletRequest(https://docs.oracle.com/javaee/7/api/javax/servlet/ServletRequest.html)objectthat

containstherequestfromtheclientandaServletResponse(https://docs.oracle.com/javaee/7/api/java
x/servlet/ServletResponse.html)objectusedtocreatetheresponsereturnedtotheclient.Theservice()
methoddeclaresthatitthrowstheexceptionsServletException(https://docs.oracle.com/javaee/7/api/j
avax/servlet/ServletException.html)andIOException(https://docs.oracle.com/javase/8/docs/api/ja
va/io/IOException.html)ifaproblempreventsitfromrespondingtotherequest.
ThesetContentType(String)(https://docs.oracle.com/javaee/7/api/javax/servlet/ServletResponse.h
tml#setContentType(java.lang.String))methodintheresponseobjectiscalledtosettheMIMEcontent
typeofthereturneddatato"text/html".ThegetWriter()(https://docs.oracle.com/javaee/7/api/java
x/servlet/ServletResponse.html#getWriter())methodintheresponsereturnsaPrintWriter(https://do
cs.oracle.com/javase/8/docs/api/java/io/PrintWriter.html)objectthatisusedtowritethedatathatis
senttotheclient.Theprintln(String)(https://docs.oracle.com/javase/8/docs/api/java/io/PrintWrite
r.html#println(java.lang.String))methodiscalledtowritethe"Hello,world!"stringtotheresponse
andthentheclose()(https://docs.oracle.com/javase/8/docs/api/java/io/PrintWriter.html#close())
methodiscalledtoclosetheprintwriter,whichcausesthedatathathasbeenwrittentothestreamtobe
returnedtotheclient.

JavaServerPages

JavaServerPages(JSP)areserversideJavaEEcomponentsthatgenerateresponses,typicallyHTML
pages,toHTTPrequestsfromclients.JSPsembedJavacodeinanHTMLpagebyusingthespecial
delimiters<%and%>.AJSPiscompiledtoaJavaservlet,aJavaapplicationinitsownright,thefirsttimeit
isaccessed.Afterthat,thegeneratedservletcreatestheresponse.

Swingapplication
SwingisagraphicaluserinterfacelibraryfortheJavaSEplatform.Itispossibletospecifyadifferentlook
andfeelthroughthepluggablelookandfeelsystemofSwing.ClonesofWindows,GTK+andMotifare
suppliedbySun.ApplealsoprovidesanAqualookandfeelforMacOSX.Wherepriorimplementations
oftheselooksandfeelsmayhavebeenconsideredlacking,SwinginJavaSE6addressesthisproblemby
usingmorenativeGUIwidgetdrawingroutinesoftheunderlyingplatforms.
ThisexampleSwingapplicationcreatesasinglewindowwith"Hello,world!"inside:
//Hello.java(JavaSE5)
importjavax.swing.*;
publicclassHelloextendsJFrame{
publicHello(){
super("hello");
super.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
super.add(newJLabel("Hello,world!"));
super.pack();
super.setVisible(true);
}
publicstaticvoidmain(finalString[]args){
newHello();
}
}

Thefirstimportincludesallthepublicclassesandinterfacesfromthejavax.swing(https://docs.oracle.
com/javase/8/docs/api/javax/swing/packagesummary.html)package.
TheHelloclassextendstheJFrame(https://docs.oracle.com/javase/8/docs/api/javax/swing/JFrame.ht
ml)classtheJFrameclassimplementsawindowwithatitlebarandaclosecontrol.
TheHello()constructorinitializestheframebyfirstcallingthesuperclassconstructor,passingthe
parameter"hello",whichisusedasthewindow'stitle.ItthencallsthesetDefaultCloseOperation(int)(h
ttps://docs.oracle.com/javase/8/docs/api/javax/swing/JFrame.html#setDefaultCloseOperation(int))

methodinheritedfromJFrametosetthedefaultoperationwhentheclosecontrolonthetitlebarisselected
toWindowConstants.EXIT_ON_CLOSE(https://docs.oracle.com/javase/8/docs/api/javax/swing/WindowCon
stants.html#EXIT_ON_CLOSE)thiscausestheJFrametobedisposedofwhentheframeisclosed(as
opposedtomerelyhidden),whichallowstheJavavirtualmachinetoexitandtheprogramtoterminate.
Next,aJLabel(https://docs.oracle.com/javase/8/docs/api/javax/swing/JLabel.html)iscreatedforthe
string"Hello,world!"andtheadd(Component)(https://docs.oracle.com/javase/8/docs/api/java/awt/C
ontainer.html#add(java.awt.Component))methodinheritedfromtheContainer(https://docs.oracle.co
m/javase/8/docs/api/java/awt/Container.html)superclassiscalledtoaddthelabeltotheframe.The

pack()(https://docs.oracle.com/javase/8/docs/api/java/awt/Window.html#pack())methodinherited

fromtheWindow(https://docs.oracle.com/javase/8/docs/api/java/awt/Window.html)superclassiscalled
tosizethewindowandlayoutitscontents.
Themain()methodiscalledbytheJavavirtualmachinewhentheprogramstarts.Itinstantiatesanew
HelloframeandcausesittobedisplayedbycallingthesetVisible(boolean)(https://docs.oracle.com/j
avase/8/docs/api/java/awt/Component.html#setVisible(boolean))methodinheritedfromtheComponent
(https://docs.oracle.com/javase/8/docs/api/java/awt/Component.html)superclasswiththeboolean
parametertrue.Oncetheframeisdisplayed,exitingthemainmethoddoesnotcausetheprogramto
terminatebecausetheAWTeventdispatchingthreadremainsactiveuntilalloftheSwingtoplevel
windowshavebeendisposed.

Generics
In2004,genericswereaddedtotheJavalanguage,aspartofJ2SE5.0.Priortotheintroductionofgenerics,
eachvariabledeclarationhadtobeofaspecifictype.Forcontainerclasses,forexample,thisisaproblem
becausethereisnoeasywaytocreateacontainerthatacceptsonlyspecifictypesofobjects.Eitherthe
containeroperatesonallsubtypesofaclassorinterface,usuallyObject,oradifferentcontainerclasshasto
becreatedforeachcontainedclass.Genericsallowcompiletimetypecheckingwithouthavingtocreate
manycontainerclasses,eachcontainingalmostidenticalcode.Inadditiontoenablingmoreefficientcode,
certainruntimeexceptionsareconvertedtocompiletimeerrors,acharacteristicknownastypesafety.

Criticism
CriticismsdirectedatJavaincludetheimplementationofgenerics,[51]speed,[52]thehandlingofunsigned
numbers,[53]theimplementationoffloatingpointarithmetic,[54]andahistoryofsecurityvulnerabilitiesin
theprimaryJavaVMimplementationHotSpot.[55]

Useonunofficialsoftwareplatforms
TheJavaprogramminglanguagerequiresthepresenceofasoftwareplatforminorderforcompiled
programstobeexecuted.AwellknownunofficialJavalikesoftwareplatformistheAndroidsoftware
platform,whichallowstheuseofJava6andsomeJava7features,usesadifferentstandardlibrary(Apache
Harmonyreimplementation),differentbytecodelanguageanddifferentvirtualmachine,andisdesignedfor
lowmemorydevicessuchassmartphonesandtabletcomputers.

Google
TheJavalanguageisakeypillarinAndroid,anopensourcemobileoperatingsystem.AlthoughAndroid,
builtontheLinuxkernel,waswrittenlargelyinC,theAndroidSDKusestheJavalanguageasthebasisfor
Androidapplications.However,AndroiddoesnotusethestandardJavavirtualmachine,insteadusingJava
bytecodeasanintermediatestepwhichistransformedintoDalvikbytecode.DependingontheAndroid
version,thisistheneitherinterpretedbytheDalvikvirtualmachine,orcompiledintonativecodebythe
AndroidRuntime.

AndroidalsodoesnotprovidethefullJavaSEstandardlibrary,althoughthe
Androidclasslibrarydoesincludeanindependentimplementationofalarge
subsetofit.ThisledtoalegaldisputebetweenOracleandGoogle.OnMay
7,2012,aSanFranciscojuryfoundthatifAPIscouldbecopyrighted,then
GooglehadinfringedOracle'scopyrightsbytheuseofJavainAndroid
devices.[56]DistrictJudgeWilliamHaskellAlsupruledonMay31,2012,
thatAPIscannotbecopyrighted,[57]butthiswasreversedbytheUnited
StatesCourtofAppealsfortheFederalCircuitinMay2014.[58][59][60]

Classlibraries
TheJavaClassLibraryisthestandardlibrary,developedtosupport
applicationdevelopmentinJava.ItiscontrolledbySunMicrosystemsin
cooperationwithothersthroughtheJavaCommunityProcessprogram.
Companiesorindividualsparticipatinginthisprocesscaninfluencethe
designanddevelopmentoftheAPIs.Thisprocesshasbeenasubjectof
controversy.Theclasslibrarycontainsfeaturessuchas:

TheAndroidoperating
systemmakesextensiveuse
ofJavarelatedtechnology

Thecorelibraries,whichinclude:
IO/NIO
Networking
Reflection
Concurrency
Generics
Scripting/Compiler
FunctionalProgramming(Lambda,Streaming)
Collectionlibrariesthatimplementdatastructuressuchaslists,dictionaries,trees,sets,queues
anddoubleendedqueue,orstacks[61]
XMLProcessing(Parsing,Transforming,Validating)libraries
Security[62]
Internationalizationandlocalizationlibraries[63]
Theintegrationlibraries,whichallowtheapplicationwritertocommunicatewithexternalsystems.
Theselibrariesinclude:
TheJavaDatabaseConnectivity(JDBC)APIfordatabaseaccess
JavaNamingandDirectoryInterface(JNDI)forlookupanddiscovery
RMIandCORBAfordistributedapplicationdevelopment
JMXformanagingandmonitoringapplications
Userinterfacelibraries,whichinclude:
The(heavyweight,ornative)AbstractWindowToolkit(AWT),whichprovidesGUI
components,themeansforlayingoutthosecomponentsandthemeansforhandlingevents
fromthosecomponents
The(lightweight)Swinglibraries,whicharebuiltonAWTbutprovide(nonnative)
implementationsoftheAWTwidgetry
APIsforaudiocapture,processing,andplayback
JavaFX
AplatformdependentimplementationoftheJavavirtualmachinethatisthemeansbywhichthe
bytecodesoftheJavalibrariesandthirdpartyapplicationsareexecuted
Plugins,whichenableappletstoberuninwebbrowsers

JavaWebStart,whichallowsJavaapplicationstobeefficientlydistributedtoendusersacrossthe
Internet
Licensinganddocumentation

Documentation
Javadocisacomprehensivedocumentationsystem,createdbySunMicrosystems,usedbymanyJava
developers.Itprovidesdeveloperswithanorganizedsystemfordocumentingtheircode.Javadoc
commentshaveanextraasteriskatthebeginning,i.e.thedelimitersare/**and*/,whereasthenormal
multilinecommentsinJavaaresetoffwiththedelimiters/*and*/.[64]

Editions
SunhasdefinedandsupportsfoureditionsofJavatargetingdifferentapplicationenvironmentsand
segmentedmanyofitsAPIssothattheybelongtooneoftheplatforms.Theplatformsare:
JavaCardforsmartcards.[65]
JavaPlatform,MicroEdition(JavaME)targetingenvironmentswithlimitedresources.[66]
JavaPlatform,StandardEdition(JavaSE)targetingworkstationenvironments.[67]
JavaPlatform,EnterpriseEdition(JavaEE)targetinglargedistributedenterpriseorInternet
environments.[68]
TheclassesintheJavaAPIsareorganizedintoseparategroupscalledpackages.Eachpackagecontainsa
setofrelatedinterfaces,classesandexceptions.Refertotheseparateplatformsforadescriptionofthe
packagesavailable.
SunalsoprovidedaneditioncalledPersonalJavathathasbeensupersededbylater,standardsbasedJava
MEconfigurationprofilepairings.

Seealso
DalvikusedinoldAndroidversions,replacedbynonJITAndroidRuntime
JavaOne
Javapedia
ListofJavavirtualmachines
ListofJavaAPIs
ListofJVMlanguages
Graal(compiler),aprojectaimingtoimplementahighperformanceJavadynamiccompilerand
interpreter
SpringFramework

ComparisonofJavawithotherlanguages
Comparisonofprogramminglanguages
ComparisonofJavaandC++
ComparisonofC#andJava

Notes
1.Binstock,Andrew(20May2015)."Java's20YearsOfInnovation".Forbes.Retrieved18March2016.
2.Harry.H.Chaudhary(28July2014)."CrackingTheJavaProgrammingInterview::2000+JavaInterview
Que/Ans".Retrieved29May2016.
3.Java5.0addedseveralnewlanguagefeatures(theenhancedforloop,autoboxing,varargsandannotations),after
theywereintroducedinthesimilar(andcompeting)C#language[1](http://www.barrycornelius.com/papers/java
5/)[2](http://www.levenez.com/lang/)
4.Gosling,JamesMcGilton,Henry(May1996)."TheJavaLanguageEnvironment".
5.Gosling,JamesJoy,BillSteele,GuyBracha,Gilad."TheJavaLanguageSpecification,2ndEdition".
6."TheAZofProgrammingLanguages:Modula3".Computerworld.com.au.Retrieved20100609.
7.NiklausWirthstatedonanumberofpublicoccasions,e.g.inalectureatthePolytechnicMuseum,Moscowin
September,2005(severalindependentfirsthandaccountsinRussianexist,e.g.onewithanaudiorecording:
Filippova,Elena(September22,2005)."NiklausWirth'slectureatthePolytechnicMuseuminMoscow".),that
theSunJavadesignteamlicensedtheOberoncompilersourcesanumberofyearspriortothereleaseofJavaand
examinedit:a(relative)compactness,typesafety,garbagecollection,nomultipleinheritanceforclassesall
thesekeyoveralldesignfeaturesaresharedbyJavaandOberon.
8.PatrickNaughtoncitesObjectiveCasastronginfluenceonthedesignoftheJavaprogramminglanguage,stating
thatnotabledirectderivativesincludeJavainterfaces(derivedfromObjectiveC'sprotocol)andprimitivewrapper
classes.[3](http://cs.gmu.edu/~sean/stuff/javaobjc.html)
9.TechMetrixResearch(1999)."HistoryofJava"(PDF).JavaApplicationServersReport."Theprojectwentahead
underthename"green"andthelanguagewasbasedonanoldmodelofUCSDPascal,whichmakesitpossibleto
generateinterpretivecode"
10."AConversationwithJamesGoslingACMQueue".Queue.acm.org.20040831.Retrieved20100609.
11.Inthesummerof1996,SunwasdesigningtheprecursortowhatisnowtheeventmodeloftheAWTandthe
JavaBeansTMcomponentarchitecture.Borlandcontributedgreatlytothisprocess.Welookedverycarefullyat
DelphiObjectPascalandbuiltaworkingprototypeofboundmethodreferencesinordertounderstandtheir
interactionwiththeJavaprogramminglanguageanditsAPIs.WhitePaperAboutMicrosoft's"Delegates"(https://
web.archive.org/web/20120627043929/http://java.sun.com/docs/white/delegates.html)
12."Chapelspec(Acknowledgements)"(PDF).CrayInc.20151001.Retrieved20160114.
13."FacebookQ&A:HackbringsstatictypingtoPHPworld".InfoWorld.20140326.Retrieved20150111.
14.Goslingetal.2014,p.1.
15."Writeonce,runanywhere?".ComputerWeekly.20020502.Retrieved20090727.
16."1.2DesignGoalsoftheJavaProgrammingLanguage".Oracle.19990101.Retrieved20130114.
17.McMillan,Robert(20130801)."IsJavaLosingItsMojo?".wired.com."Javaisonthewane,atleastaccording
tooneoutfitthatkeepsoneyeontheeverchangingworldofcomputerprogramminglanguages.Formorethana
decade,ithasdominatedtheTIOBEProgrammingCommunityIndex,andisbackontopasnapshotof
softwaredeveloperenthusiasmthatlooksatthingslikeinternetsearchresultstomeasurehowmuchbuzz
differentlanguageshave.Butlately,Javahasbeenslipping."
18.RedMonkIndex(http://redmonk.com/sogrady/2015/01/14/languagerankings115/)onredmonk.com(Stephen
O'Grady,January2015)
19."ProgrammingLanguagePopularity".langpop.com.20131025.Retrieved20150402."Normalized
Comparison:1stC,2ndJava,3rdPHP"
20."TIOBEProgrammingCommunityIndex".2015.Retrieved20150403.
21.Byous,Jon(c.1998)."Javatechnology:Theearlyyears".SunDeveloperNetwork.SunMicrosystems.Archived
fromtheoriginalon20050420.Retrieved20050422.
22.Objectorientedprogramming"TheHistoryofJavaTechnology".SunDeveloperNetwork.c.1995.Retrieved
20100430.
23."SowhydidtheydecidetocallitJava?(http://www.javaworld.com/jw101996/jw10javaname.html)",Kieron
Murphy,JavaWorld.com,10/04/96
24.Kabutz,HeinzOnceUponanOak(http://www.artima.com/weblogs/viewpost.jsp?thread=7555).Artima.
RetrievedApril29,2007.
25."TheHistoryofJavaTechnology".RetrievedOctober6,2012.

26.https://blogs.oracle.com/javaplatformgroup/entry/moving_to_a_plugin_free
27.ObjectorientedProgrammingwithJava:EssentialsandApplications.TataMcGrawHillEducation.p.34.
28."JSGJavaStudyGroup".openstd.org.
29."WhyJavaWasNotStandardizedTwice"(PDF).
30."WhatisECMAandwhyMicrosoftcares".
31."JavaCommunityProcesswebsite".Jcp.org.20100524.Retrieved20100609.
32."JAVAONE:SunThebulkofJavaisopensourced".GrnLight.net.Retrieved20140526.
33."Sun'sEvolvingRoleasJavaEvangelist".O'ReillyMedia.
34."OracleandJava".oracle.com.OracleCorporation.Retrieved20100823."Oraclehasbeenaleadingand
substantivesupporterofJavasinceitsemergencein1995andtakesonthenewroleasstewardofJavatechnology
witharelentlesscommitmenttofosteringacommunityofparticipationandtransparency."
35."LearnAboutJavaTechnology".Oracle.Retrieved21November2011.
36.Gosling,James(April9,2010)."Timetomoveon...".OnaNewRoad.Retrieved20111116.
37."IstheJVM(JavaVirtualMachine)platformdependentorplatformindependent?Whatistheadvantageofusing
theJVM,andhavingJavabeatranslatedlanguage?".ProgrammerInterview.Retrieved20150119.
38.Niccolai,James(January23,2001)."Sun,MicrosoftsettleJavalawsuit".JavaWorld(InternationalDataGroup).
Retrieved20080709.
39.Jelovic,Dejan."WhyJavawillalwaysbeslowerthanC++".Retrieved20080215.
40.Google."LoopRecognitioninC++/Java/Go/Scala"(PDF).Retrieved20120712.
41."Symantec'sJustInTimeJavaCompilerToBeIntegratedintoSunJDK1.1".
42."NullPointerException".Oracle.Retrieved20140506.
43."ExceptionsinJava".Artima.com.Retrieved20100810.
44."JavaHotSpotVMOptions".Oracle.com.20100907.Retrieved20120630.
45.http://docs.oracle.com/javase/7/docs/technotes/guides/vm/G1.html
46."OperatorOverloading(C#vsJava)".C#forJavaDevelopers.Microsoft.Retrieved10December2014.
47."MultipleInheritanceofState,Implementation,andType".TheJavaTutorials.Oracle.Retrieved10December
2014.
48."Lesson:ACloserLookatthe"HelloWorld!"Application".TheJavaTutorials>GettingStarted.Oracle
Corporation.Retrieved20110414.
49."Usingapplet,objectandembedTags".oracle.com.Retrieved20101014.
50."DeployingAppletsinaMixedBrowserEnvironment".oracle.com.Retrieved20101014.
51.Arnold,Ken."GenericsConsideredHarmful".java.net.Retrieved4July2011.
52.Jelovic,Dejan."WhyJavaWillAlwaysBeSlowerthanC++".www.jelovic.com.Retrieved17October2012.
53.Owens,SeanR."Javaandunsignedint,unsignedshort,unsignedbyte,unsignedlong,etc.(Orrather,thelack
thereof)".Archivedfromtheoriginalon20041109.Retrieved20110704.
54.Kahan,William."HowJava'sFloatingPointHurtsEveryoneEverywhere"(PDF).ElectricalEngineering&
ComputerScience,UniversityofCaliforniaatBerkeley.Retrieved4June2011.
55."HaveyoucheckedtheJava?".
56.Mullin,Joe."GoogleguiltyofinfringementinOracletrialfuturelegalheadachesloom".Law&Disorder.Ars
Technica.Retrieved8May2012.
57.JoeMullin(May31,2012)."GooglewinscrucialAPIruling,Oracle'scasedecimated".ArsTechnica.Retrieved
20120601.
58.http://www.cafc.uscourts.gov/images/stories/opinionsorders/131021.Opinion.572014.1.PDF
59.Rosenblatt,Seth(May9,2014)."CourtsideswithOracleoverAndroidinJavapatentappeal".CNET.Retrieved
20140510.
60."ORACLEAMERICA,INC.,PlaintiffAppellant,v.GOOGLEINC.,DefendantCrossAppellant."(PDF).
CourtofAppealsfortheFederalCircuit.May9,2014.Retrieved20140510.
61."CollectionsFrameworkOverview".JavaDocumentation.Oracle.Retrieved18December2014.
62."JavaSecurityOverview".JavaDocumentation.Oracle.Retrieved18December2014.
63."Trail:Internationalization".TheJavaTutorials.Oracle.Retrieved18December2014.
64."HowtoWriteDocCommentsfortheJavadocTool".OracleTechnologyNetwork.Oracle.Retrieved
18December2014.
65."JavaCardOverview".OracleTechnologyNetwork.Oracle.Retrieved18December2014.

66."JavaPlatform,MicroEdition(JavaME)".OracleTechnologyNetwork.Oracle.Retrieved18December2014.
67."JavaSE".OracleTechnologyNetwork.Oracle.Retrieved18December2014.
68."JavaPlatform,EnterpriseEdition(JavaEE)".OracleTechnologyNetwork.Oracle.Retrieved18December
2014.

References
Gosling,JamesJoy,BillSteele,GuyBracha,GiladBuckley,Alex(2014).TheJavaLanguageSpecification
(PDF)(JavaSE8ed.).
Gosling,JamesJoy,BillSteele,GuyL.,Jr.Bracha,Gilad(2005).TheJavaLanguageSpecification(3rded.).
AddisonWesley.ISBN0321246780.
Lindholm,TimYellin,Frank(1999).TheJavaVirtualMachineSpecification(2nded.).AddisonWesley.
ISBN0201432943.

Externallinks
Retrievedfrom"https://en.wikipedia.org/w/index.php?
title=Java_(programming_language)&oldid=723122176"

Wikiversityhaslearning
materialsaboutJava
Platform,Enterprise
Edition/JavaEETutorial

Categories: Cprogramminglanguagefamily
Classbasedprogramminglanguages Concurrentprogramminglanguages Crossplatformsoftware
Java(programminglanguage) Javaplatform Javaspecificationrequests
JVMprogramminglanguages Objectorientedprogramminglanguages Programminglanguages
Programminglanguagescreatedin1995 Staticallytypedprogramminglanguages SunMicrosystems

Thispagewaslastmodifiedon1June2016,at04:23.
TextisavailableundertheCreativeCommonsAttributionShareAlikeLicenseadditionaltermsmay
apply.Byusingthissite,youagreetotheTermsofUseandPrivacyPolicy.Wikipediaisa
registeredtrademarkoftheWikimediaFoundation,Inc.,anonprofitorganization.

You might also like