Jump to content

Java (programming language): Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
rv edit by Nigelj: while code can call the System.runFinalization(), but they can't control when finalization is executed because no guarantee is made
 
Line 1: Line 1:
{{Short description|Object-oriented programming language}}
{{Distinguish|Java (software platform)|JavaScript|Javanese language}}
{{Redirect|Openframe|the ten-pin bowling term|Open frame}}
{{Pp-semi-indef|small=yes}}
{{Use mdy dates|date=August 2017}}
{{Infobox programming language
{{Infobox programming language
|name = Java
| name = Java
|logo = [[Image:Java logo.gif|100px]]
| logo = Java programming language logo.svg
| logo size = 121px
|paradigm = [[Object-oriented programming|object-oriented]]
| logo caption =
|year = 1990s
| paradigm = [[Programming paradigm#Multi-paradigm|Multi-paradigm]]: [[generic programming|generic]], [[object-oriented]] ([[class-based programming|class-based]]), [[functional programming|functional]], [[imperative programming|imperative]], [[reflective programming|reflective]], [[concurrent computing|concurrent]]
|designer = [[Sun Microsystems]]
| year = {{Start date and age|1995|5|23}}<ref>{{cite magazine|url=https://www.forbes.com/sites/oracle/2015/05/20/javas-20-years-of-innovation/|title=Java's 20 Years of Innovation|magazine=Forbes|date=May 20, 2015|access-date=March 18, 2016|author=Binstock, Andrew|archive-url=https://web.archive.org/web/20160314102242/http://www.forbes.com/sites/oracle/2015/05/20/javas-20-years-of-innovation/|archive-date=March 14, 2016|url-status=live}}</ref>
|typing = strong, static
| discontinued = <!-- Set to yes if software is discontinued, otherwise omit. -->
|implementations = numerous
| ver layout = <!-- simple (default) or stacked -->
|dialects =
| latest release version = {{wikidata|property|preferred|references|edit|Q251|P348|P548=Q2804309}}
|influenced_by = [[Objective-C]], [[C++]], [[Smalltalk]]
| latest release date = {{Start date and age|{{wikidata|qualifier|preferred|single|Q251|P348|P548=Q2804309|P577}}}}
|influenced = [[C sharp|C#]], [[J sharp|J#]], [[Visual J sharp|VJ#]], [[JavaScript]]
| designer = [[James Gosling]]
}}'''Java''' is an [[Object-oriented programming|object-oriented]] [[programming language]] developed by [[James Gosling]] and colleagues at [[Sun Microsystems]] in the early 1990s. Unlike conventional languages which are generally designed to be compiled to native code, Java is compiled to a bytecode which is then run (generally using [[JIT compilation]]) by a [[Java virtual machine]].
| developer = [[Oracle Corporation]]
| typing = [[type system|Static, strong, safe]], [[nominal type system|nominative]], [[manifest typing|manifest]]
| memory management = [[Garbage collection (computer science)|Automatic garbage collection]]
| influenced_by = [[CLU (programming language)|CLU]],<ref name="BarbaraLiskov">{{cite book |title=Program Development in Java – Abstraction, Specification, and Object-Oriented Design|author=[[Barbara Liskov]] with [[John Guttag]]|isbn=978-0-201-65768-5|publisher=USA, Addison Wesley|year=2000}}</ref> [[Simula67]],<ref name="BarbaraLiskov" /> [[Lisp (programming language)|Lisp]],<ref name="BarbaraLiskov" /> [[Smalltalk]],<ref name="BarbaraLiskov" /> [[Ada (programming language)|Ada 83]], [[C++]],<ref>{{cite web|url=https://books.google.com/books?id=0rUtBAAAQBAJ&pg=PAPA133|title=Cracking The Java Programming Interview :: 2000+ Java Interview Que/Ans|first=Harry H.|last=Chaudhary|access-date=2016-05-29|date=2014-07-28|archive-date=September 29, 2023|archive-url=https://web.archive.org/web/20230929040943/https://books.google.com/books?id=0rUtBAAAQBAJ&pg=PAPA133#v=onepage&q&f=false|url-status=live}}</ref> [[C Sharp (programming language)|C#]],<ref>Java&nbsp;5.0 added several new language features (the [[foreach loop|enhanced for loop]], [[object type (object-oriented programming)#Autoboxing|autoboxing]], [[variadic function|varargs]] and [[Java annotation|annotations]]), after they were introduced in the similar (and competing) [[C Sharp (programming language)|C#]] language. [http://www.barrycornelius.com/papers/java5/] {{Webarchive|url=https://web.archive.org/web/20110319065438/http://www.barrycornelius.com/papers/java5/|date=March 19, 2011}} [http://www.levenez.com/lang/] {{Webarchive|url=https://web.archive.org/web/20060107162045/http://www.levenez.com/lang/|date=January 7, 2006}}</ref> [[Eiffel (programming language)|Eiffel]],<ref>{{cite web|author1=Gosling, James|author2=McGilton, Henry|title=The Java Language Environment|date=May 1996|url=https://www.oracle.com/technetwork/java/langenv-140151.html|access-date=May 6, 2014|archive-url=https://web.archive.org/web/20140506214653/http://www.oracle.com/technetwork/java/langenv-140151.html|archive-date=May 6, 2014 |url-status=live}}</ref> [[Mesa (programming language)|Mesa]],<ref>{{cite web|author1=Gosling, James|author2=Joy, Bill |author3=Steele, Guy|author4=Bracha, Gilad|title=The Java Language Specification, 2nd Edition |url=https://java.sun.com/docs/books/jls/second_edition/html/intro.doc.html#237601|access-date=February 8, 2008|archive-url=https://web.archive.org/web/20110805051057/http://java.sun.com/docs/books/jls/second_edition/html/intro.doc.html#237601|archive-date=August 5, 2011 |url-status=live}}</ref> [[Modula-3]],<ref>{{cite web |url=http://www.computerworld.com.au/index.php/id;1422447371;pp;3;fp;4194304;fpid;1|title=The A-Z of Programming Languages: Modula-3 |publisher=Computerworld|access-date=2010-06-09|url-status=dead|archive-url=https://web.archive.org/web/20090105145818/http://www.computerworld.com.au/index.php/id%3B1422447371%3Bpp%3B3%3Bfp%3B4194304%3Bfpid%3B1|archive-date=January 5, 2009}}</ref> [[Oberon (programming language)|Oberon]],<ref>[[Niklaus Wirth]] stated on a number of public occasions, e.g. in a lecture at the Polytechnic Museum, Moscow in September 2005 (several independent first-hand accounts in Russian exist, e.g. one with an audio recording: {{cite web|author=Filippova, Elena|title=Niklaus Wirth's lecture at the Polytechnic Museum in Moscow|date=September 22, 2005|url=http://www.delphikingdom.com/asp/viewitem.asp?catalogid=1155|access-date=November 20, 2011|archive-date=December 1, 2020|archive-url=https://web.archive.org/web/20201201054813/http://www.delphikingdom.com/asp/viewitem.asp?catalogid=1155|url-status=live}}), that the Sun Java design team licensed the Oberon compiler sources a number of years prior to the release of Java and examined it: a (relative) compactness, type safety, garbage collection, no multiple inheritance for classes{{snd}} all these key overall design features are shared by Java and Oberon.</ref> [[Objective-C]],<ref>[[Patrick Naughton]] cites [[Objective-C]] as a strong influence on the design of the Java programming language, stating that notable direct derivatives include Java interfaces (derived from Objective-C's [[Objective-C#Protocols|protocol]]) and primitive wrapper classes. [http://cs.gmu.edu/~sean/stuff/java-objc.html] {{Webarchive|url=https://web.archive.org/web/20110713014816/http://cs.gmu.edu/~sean/stuff/java-objc.html|date=July 13, 2011}}</ref> [[UCSD Pascal]],<ref>{{cite web |url=http://www.fscript.org/prof/javapassport.pdf |quote=The project went ahead under the name ''green'' and the language was based on an old model of [[UCSD Pascal]], which makes it possible to generate interpretive code. |title=History of Java|work=Java Application Servers Report|author=TechMetrix Research|year=1999|archive-url=https://web.archive.org/web/20101229090912/http://www.fscript.org/prof/javapassport.pdf|archive-date=December 29, 2010|url-status=dead}}</ref><ref>{{cite magazine |title=A Conversation with James Gosling |magazine=[[ACM Queue]] |date=August 31, 2004 |url=http://queue.acm.org/detail.cfm?id=1017013 |publisher=[[Association for Computing Machinery]] |volume=2 |issue=5 |access-date=2010-06-09|archive-url=https://web.archive.org/web/20150716194245/http://queue.acm.org/detail.cfm?id=1017013|archive-date=July 16, 2015 |url-status=live}}</ref> [[Object Pascal]]<ref>{{cite report |author=((The Java Language Team)) |publisher=JavaSoft, Sun Microsystems, Inc. |url=http://java.sun.com/docs/white/delegates.html |quote=In the summer of 1996, Sun was designing the precursor to what is now the event model of the AWT and the JavaBeans component architecture. Borland contributed greatly to this process. We looked very carefully at Delphi Object Pascal and built a working prototype of bound method references in order to understand their interaction with the Java programming language and its APIs. |archive-url=https://web.archive.org/web/20120627043929/http://java.sun.com/docs/white/delegates.html |archive-date=2012-06-27 |url-status=dead |type=White Paper |title=About Microsoft's 'Delegates'}}</ref>
| influenced = [[Ada (programming language)|Ada 2005]], [[ArkTS]], [[BeanShell]], [[C Sharp (programming language)|C#]], [[Chapel (programming language)|Chapel]],<ref name="chplspec">{{cite web|title=Chapel spec (Acknowledgements)|url=http://chapel.cray.com/spec/spec-0.98.pdf|date=2015-10-01|access-date=2016-01-14|publisher=Cray Inc.|archive-url=https://web.archive.org/web/20160205114946/http://chapel.cray.com/spec/spec-0.98.pdf|archive-date=February 5, 2016|url-status=live}}</ref> [[Clojure]], [[ECMAScript]], [[Fantom (programming language)|Fantom]], [[Gambas]],<ref name="gambas">{{cite web|url=http://gambaswiki.org/wiki/doc/intro?nh&l=en|title=Gambas Documentation Introduction|publisher=Gambas Website|access-date=2017-10-09|archive-url=https://web.archive.org/web/20171009041815/http://gambaswiki.org/wiki/doc/intro?nh&l=en|archive-date=October 9, 2017|url-status=live}}</ref> [[Groovy (programming language)|Groovy]], [[Hack (programming language)|Hack]],<ref>{{cite magazine|url=http://www.infoworld.com/article/2610885/facebook-q-a--hack-brings-static-typing-to-php-world.html|title=Facebook Q&A: Hack brings static typing to PHP world|magazine=InfoWorld|date=March 26, 2014|access-date=2015-01-11|archive-url=https://web.archive.org/web/20150213220946/http://www.infoworld.com/article/2610885/facebook-q-a--hack-brings-static-typing-to-php-world.html|archive-date=February 13, 2015|url-status=live}}</ref> [[Haxe]], [[Visual J Sharp|J#]], [[JavaScript]], [[JS++]], [[Kotlin (programming language)|Kotlin]], [[PHP]], [[Python (programming language)|Python]], [[Scala (programming language)|Scala]], [[Seed7]], [[Vala (programming language)|Vala]]
| website = {{ubl|{{URL|oracle.com/java/}}|{{URL|java.com}}|{{URL|dev.java}}}}
| file_ext = .java, [[Java class file|.class]], [[JAR (file format)|.jar]], .jmod, [[WAR (file format)|.war]]
| wikibooks = Java Programming
}}


'''Java''' is a [[High-level programming language|high-level]], [[General-purpose programming language|general-purpose]], [[Memory safety|memory-safe]], [[object-oriented programming|object-oriented]] [[programming language]]. It is intended to let [[programmer]]s ''write once, run anywhere'' ([[Write once, run anywhere|WORA]]),<ref>{{cite web|title=Write once, run anywhere?|date=May 2, 2002 |publisher=[[Computer Weekly]] |url=http://www.computerweekly.com/Articles/2002/05/02/186793/write-once-run-anywhere.htm|access-date=2009-07-27|url-status=live|archive-date=August 13, 2021|archive-url=https://web.archive.org/web/20210813193857/https://www.computerweekly.com/feature/Write-once-run-anywhere}}</ref> meaning that [[compiler|compiled]] Java code can run on all platforms that support Java without the need to recompile.<ref name="design_goals">{{cite web |title=1.2 Design Goals of the Java Programming Language|date=January 1, 1999 |url=https://www.oracle.com/technetwork/java/intro-141325.html|access-date=2013-01-14|publisher=Oracle|archive-url=https://web.archive.org/web/20130123204103/http://www.oracle.com/technetwork/java/intro-141325.html|archive-date=January 23, 2013|url-status=live}}</ref> Java applications are typically compiled to [[Java bytecode|bytecode]] that can run on any [[Java virtual machine]] (JVM) regardless of the underlying [[computer architecture]]. The [[syntax (programming languages)|syntax]] of Java is similar to [[C (programming language)|C]] and [[C++]], but has fewer [[low-level programming language|low-level]] facilities than either of them. The Java runtime provides dynamic capabilities (such as [[Reflective programming|reflection]] and runtime code modification) that are typically not available in traditional compiled languages.
The language itself borrows much syntax from [[C]] and [[C++]] but has a much simpler object model and does away with low level tools like programmer-manipulable pointers.


Java gained popularity shortly after its release, and has been a popular programming language since then.<ref>{{Cite web |last=Melanson |first=Mike |date=August 9, 2022 |title=Don't call it a comeback: Why Java is still champ |url=https://github.com/readme/featured/java-programming-language |url-status=live |archive-url=https://web.archive.org/web/20230825195416/https://github.com/readme/featured/java-programming-language |archive-date=August 25, 2023 |access-date=October 15, 2023 |website=[[GitHub]]}}</ref> Java was the third most popular programming language in {{As of|2022|bare=yes}} according to [[GitHub]].<ref>{{Cite web |title=The top programming languages |url=https://octoverse.github.com/2022/top-programming-languages |url-status=live |archive-url=https://web.archive.org/web/20230802203718/https://octoverse.github.com/2022/top-programming-languages |archive-date=2 August 2023 |access-date=15 October 2023 |website=The State of the Octoverse |publisher=[[GitHub]]}}</ref> Although still widely popular, there has been a gradual decline in use of Java in recent years with [[List of JVM languages|other languages using JVM]] gaining popularity.<ref name=":0">{{cite magazine |last=McMillan |first=Robert |date=August 1, 2013 |title=Is Java Losing Its Mojo? |url=https://www.wired.com/2013/01/java-no-longer-a-favorite/ |url-access=limited |url-status=live |magazine=[[wired.com|Wired]] |archive-url=https://web.archive.org/web/20170215115409/https://www.wired.com/2013/01/java-no-longer-a-favorite/ |archive-date=February 15, 2017 |access-date=October 15, 2023 |quote=}}</ref>
Java is only distantly related to [[JavaScript]], though they have similar names and share a [[C programming language|C]]-like [[Syntax#Syntax in computer science|syntax]].


Java was designed by [[James Gosling]] at [[Sun Microsystems]]. It was released in May 1995 as a core component of Sun's [[Java (software platform)|Java platform]]. The original and [[reference implementation]] Java [[compiler]]s, virtual machines, and [[library (computing)|class libraries]] were released by Sun under [[proprietary license]]s. As of May 2007, in compliance with the specifications of the [[Java Community Process]], Sun had [[Software relicensing|relicensed]] most of its Java technologies under the [[GNU General Public License|GPL-2.0-only]] license. [[Oracle Corporation|Oracle]], which bought Sun in 2010, offers its own [[HotSpot (virtual machine)|HotSpot]] Java Virtual Machine. However, the official [[reference implementation]] is the [[OpenJDK]] JVM, which is open-source software used by most developers and is the default JVM for almost all Linux distributions.
==Version history==
:''This history focuses on the programming language, for a more complete history of Java see: [[Java (Sun)]].''


[[Java version history|Java 24]] is the version current {{as of|lc=y|2025|March}}. Java 8, 11, 17, and 21 are [[long-term support]] versions still under maintenance.
As with other parts of the [[Java platform]], the Java language has evolved over the years while largely maintaining backwards compatibility.
* '''JDK 1.0''' ([[January 23]], [[1996]]) &mdash; Initial release. <sup>([http://www.sun.com/smi/Press/sunflash/1996-01/sunflash.960123.10561.html press release])</sup>
* '''JDK 1.1''' ([[February 19]], [[1997]]) <sup>([http://www.sun.com/smi/Press/sunflash/1997-02/sunflash.970219.0001.html press release])</sup>
** [[inner class]]es added to the language
* '''J2SE 1.2''' ([[December 8]], [[1998]]) &mdash; Codename ''Playground''. This and subsequent releases through J2SE 5.0 were rebranded '''Java 2''' and the version name "J2SE" ([[Java 2 Platform, Standard Edition]]) replaced JDK to distinguish the base platform from J2EE ([[Java 2 Platform, Enterprise Edition]]) and J2ME ([[Java 2 Platform, Micro Edition]]). Major additions included: <sup>([http://www.sun.com/smi/Press/sunflash/1998-12/sunflash.981208.9.html press release])</sup>
** <code>[[strictfp]]</code> keyword
* '''J2SE 1.3''' ([[May 8]], [[2000]]) &mdash; Codename ''Kestrel''. <sup>([http://www.sun.com/smi/Press/sunflash/2000-05/sunflash.20000508.3.html press release])([http://java.sun.com/j2se/1.3/docs/relnotes/features.html full list of changes])</sup>
* '''J2SE 1.4''' ([[February 6]], [[2002]]) &mdash; Codename ''Merlin''. This was the first release of the Java platform developed under the Java Community Process as [http://www.jcp.org/en/jsr/detail?id=59 JSR&nbsp;59]. Major changes included: <sup>([http://www.sun.com/smi/Press/sunflash/2002-02/sunflash.20020206.5.html press release])([http://java.sun.com/j2se/1.4.2/docs/relnotes/features.html full list of changes])</sup>
* '''J2SE 5.0''' ([[September 30]], [[2004]]) &mdash; Codename ''Tiger''. (Originally numbered 1.5, which is still used as the internal version number.[http://java.sun.com/j2se/1.5.0/docs/relnotes/version-5.0.html]) Developed under [http://www.jcp.org/en/jsr/detail?id=176 JSR&nbsp;176], Tiger added a number of significant new language features: <sup>([http://www.sun.com/smi/Press/sunflash/2004-09/sunflash.20040930.1.html press release])</sup>
** [[Generic programming|Generics]] &mdash; provides compile-time (static) [[type safety]] for collections and eliminates the need for most [[typecasting (programming)|typecasts]]. (Specified by [http://www.jcp.org/en/jsr/detail?id=14 JSR&nbsp;14].)
** [[Metadata (computing)|Metadata]] &mdash; also called [[annotation]]s, allows language constructs such as classes and methods to be tagged with additional data, which can then be processed by metadata-aware utilities. (Specified by [http://www.jcp.org/en/jsr/detail?id=175 JSR&nbsp;175].)
** [[Autoboxing]]/unboxing &mdash; automatic conversions between [[primitive type]]s (such as <code>int</code>) and [[primitive wrapper class]]es (such as {{Javadoc:SE|java/lang|Integer}}). (Specified by [http://www.jcp.org/en/jsr/detail?id=201 JSR&nbsp;201].)
** [[Enumeration (programming)|Enumerations]] &mdash; the <code>enum</code> keyword creates a [[type safety|typesafe]], ordered list of values (such as <code>Day.MONDAY</code>, <code>Day.TUESDAY</code>, etc.). Previously this could only be achieved by non-typesafe constant integers or manually constructed classes (typesafe enum pattern). (Specified by JSR&nbsp;201.)
** Varargs &mdash; the last parameter of a method can now be declared using a type name followed by three dots (e.g. <code>void drawtext(String... lines)</code>). In the calling code any number of parameters of that type can be used and they are then placed in an array to be passed to the method.
** Enhanced <code>for</code> [[program loop|loop]] &mdash; the <code>for</code> loop syntax is extended with special syntax for iterating over each member of either an array or any {{Javadoc:SE|java/lang|Iterable}}, such as the standard {{Javadoc:SE|java/util|Collection}} classes, using a construct of the form:
<!-- The table below indents the code example and following text by 32 pixels -->
{|
| style="width:32px" |
|<pre><nowiki>
void displayWidgets (Iterable<Widget> widgets) {
for (Widget w : widgets) {
w.display();
}
}
</nowiki></pre>


== History ==
This example iterates over the <code>Iterable</code> object <code>widgets</code>, assigning each of its items in turn to the variable <code>w</code>, and then calling the <code>Widget</code> method <code>display()</code> for each item. (Specified by JSR&nbsp;201.)
{{See also|Java (software platform)#History}}
|}
[[File:Duke (Java mascot) waving.svg|thumb|upright=0.5|Duke, the Java mascot]]
* '''Java SE 6''' &mdash; Codename [https://mustang.dev.java.net/ ''Mustang'']. [[As of 2006]] this is currently in development under [http://www.jcp.org/en/jsr/detail?id=270 JSR&nbsp;270]. A beta version was released on February 15, 2006<sup>([http://www.sun.com/smi/Press/sunflash/2006-02/sunflash.20060215.1.html press release])</sup> and is available at [http://java.sun.com/javase/6/ http://java.sun.com/javase/6/]. Another beta is expected summer 2006 with the final release in autumn 2006. New builds including enhancements and bug fixes are released approximately weekly. As of this version, Sun replaced the name "J2SE" with '''Java SE''' and dropped the ".0" from the version number.[http://www.java.com/en/about/brand/naming.jsp]
[[File:James Gosling 2008.jpg|thumb|[[James Gosling]], the creator of Java, in 2008]]
* '''Java SE 7''' &mdash; Codename <!--enable when some actual content becomes available: [https://dolphin.dev.java.net/|''Dolphin'']-->''Dolphin''. [[As of 2006]], this is in the early planning stages. Development is expected to begin in spring 2006, with release estimated in 2008.[http://weblogs.java.net/blog/editors/archives/2004/09/evolving_a_lang.html]


[[James Gosling]], Mike Sheridan, and [[Patrick Naughton]] initiated the Java language project in June 1991.<ref>{{cite web |title=Java technology: The early years |last=Byous |first=Jon |date=c. 1998 |work=Sun Developer Network |publisher=[[Sun Microsystems]] |url=https://java.sun.com/features/1998/05/birthday.html |access-date=2005-04-22 |url-status=dead |archive-url=https://web.archive.org/web/20050420081440/http://java.sun.com/features/1998/05/birthday.html |archive-date=April 20, 2005}}</ref> Java was originally designed for interactive television, but it was too advanced for the digital cable television industry at the time.<ref>Object-oriented programming {{cite web |title=The History of Java Technology |date=c. 1995 |work=Sun Developer Network |url=http://www.java.com/en/javahistory/ |access-date=2010-04-30 |url-status=dead |archive-url=https://web.archive.org/web/20100210225651/http://www.java.com/en/javahistory/ |archive-date=February 10, 2010}}</ref> The language was initially called ''[[Oak (programming language)|Oak]]'' after an [[oak]] tree that stood outside Gosling's office. Later the project went by the name ''Green'' and was finally renamed ''Java'', from [[Java coffee]], a type of coffee from [[Indonesia]].<ref>{{cite web |last1=Murphy |first1=Kieron |date=1996-10-04 |url=https://www.infoworld.com/article/2077265/so-why-did-they-decide-to-call-it-java-.html |title=So why did they decide to call it Java? |work=[[JavaWorld]] |access-date=2020-07-13 |archive-date=July 13, 2020 |archive-url=https://web.archive.org/web/20200713234202/https://www.infoworld.com/article/2077265/so-why-did-they-decide-to-call-it-java-.html |url-status=live}}</ref> Gosling designed Java with a [[C (programming language)|C]]/[[C++]]-style syntax that system and application programmers would find familiar.<ref>Kabutz, Heinz; [http://www.artima.com/weblogs/viewpost.jsp?thread=7555 ''Once Upon an Oak''] {{Webarchive|url=https://web.archive.org/web/20070413072630/http://www.artima.com/weblogs/viewpost.jsp?thread=7555 |date=April 13, 2007}}. Artima. Retrieved April 29, 2007.</ref>
In addition to the language changes, much more dramatic changes have been made to the Java class library over the years, which has grown from a few hundred classes in JDK 1.0 to over three thousand in J2SE 5.0. Entire new APIs, such as [[Swing (Java)|Swing]] and [[Java2D]], have been introduced, and many of the original JDK 1.0 classes and methods have been [[deprecated]].


Sun Microsystems released the first public implementation as Java 1.0 in 1996.<ref name="oraclejavahistory">{{cite web |url=http://www.sun.com/smi/Press/sunflash/1996-01/sunflash.960123.10561.xml |archive-url=https://web.archive.org/web/20070310235103/http://www.sun.com/smi/Press/sunflash/1996-01/sunflash.960123.10561.xml |url-status=dead |archive-date=2007-03-10 |title=JAVASOFT SHIPS JAVA 1.0 |access-date=2018-05-13}}</ref> It promised [[write once, run anywhere]] (WORA) functionality, providing no-cost run-times on popular [[Computing platform|platforms]]. Fairly secure and featuring configurable security, it allowed network- and file-access restrictions. Major [[web browser]]s soon incorporated the ability to run [[Java applet]]s within web pages, and Java quickly became popular. The Java 1.0 compiler was re-written [[Bootstrapping (compilers)|in Java]] by [[Arthur van Hoff]] to comply strictly with the Java 1.0 language specification.<ref>{{cite book |url={{Google books|rXGMFYXFDwMC|plainurl=yes}} |title=Object-oriented Programming with Java: Essentials and Applications |publisher=Tata McGraw-Hill Education |page=34}}</ref> With the advent of Java 2 (released initially as J2SE 1.2 in December 1998{{snd}} 1999), new versions had multiple configurations built for different types of platforms. [[Java 2 Enterprise Edition|J2EE]] included technologies and APIs for enterprise applications typically run in server environments, while J2ME featured APIs optimized for mobile applications. The desktop version was renamed J2SE. In 2006, for marketing purposes, Sun renamed new J2 versions as ''[[Java Platform, Enterprise Edition|Java EE]]'', ''[[Java Platform, Micro Edition|Java ME]]'', and ''[[Java Platform, Standard Edition|Java SE]]'', respectively.
==Philosophy==
There were five primary goals in the creation of the Java language:


In 1997, Sun Microsystems approached the [[ISO/IEC JTC 1]] standards body and later the [[Ecma International]] to formalize Java, but it soon withdrew from the process.<ref>{{cite web|url=http://www.open-std.org/JTC1/SC22/JSG/|title=JSG – Java Study Group|work=open-std.org|access-date=August 2, 2006|archive-url=https://web.archive.org/web/20060825082008/http://www.open-std.org/JTC1/SC22/JSG/|archive-date=August 25, 2006|url-status=live}}</ref><ref>{{cite web |title=Why Java Was – Not – Standardized Twice |url=http://www.computer.org/csdl/proceedings/hicss/2001/0981/05/09815015.pdf |access-date=June 3, 2018 |archive-url=https://web.archive.org/web/20140113101235/http://www.computer.org/csdl/proceedings/hicss/2001/0981/05/09815015.pdf |archive-date=January 13, 2014 |url-status=live}}</ref><ref>{{cite web |url=http://www.zdnet.com/news/what-is-ecma-and-why-microsoft-cares/298821 |title=What is ECMA—and why Microsoft cares |website=[[ZDNet]] |access-date=May 6, 2014 |archive-url=https://web.archive.org/web/20140506215226/http://www.zdnet.com/news/what-is-ecma-and-why-microsoft-cares/298821 |archive-date=May 6, 2014 |url-status=live}}</ref> Java remains a [[de facto standard|''de facto'' standard]], controlled through the [[Java Community Process]].<ref>{{cite web |url=http://www.jcp.org/en/home/index |title=Java Community Process website |publisher=Jcp.org |date=May 24, 2010 |access-date=2010-06-09 |archive-url=https://web.archive.org/web/20060808070528/http://www.jcp.org/en/home/index |archive-date=August 8, 2006 |url-status=live}}</ref> At one time, Sun made most of its Java implementations available without charge, despite their [[proprietary software]] status. Sun generated revenue from Java through the selling of licenses for specialized products such as the Java Enterprise System.
# It should use the [[object-oriented programming]] methodology.
# It should allow the same program to be executed on multiple operating systems.
# It should contain built-in support for using [[computer network]]s.
# It should be designed to execute code from remote sources securely.
# It should be easy to use and borrow the good parts of older object-oriented languages like C++.


On November 13, 2006, Sun released much of its Java virtual machine (JVM) as [[free and open-source software]] (FOSS), under the terms of the [[GNU General Public License|GPL-2.0-only]] license. On May 8, 2007, Sun finished the process, making all of its JVM's core code available under [[free software]]/open-source distribution terms, aside from a small portion of code to which Sun did not hold the copyright.<ref>{{cite web |url=http://grnlight.net/index.php/programming-articles/115-javaone-sun-the-bulk-of-java-is-open-sourced |title=JAVAONE: Sun – The bulk of Java is open sourced |publisher=GrnLight.net |access-date=2014-05-26 |archive-url=https://web.archive.org/web/20140527220942/http://grnlight.net/index.php/programming-articles/115-javaone-sun-the-bulk-of-java-is-open-sourced |archive-date=May 27, 2014 |url-status=usurped}}</ref>
To achieve the goals of networking support and remote code execution, Java programmers sometimes find it necessary to use extensions such as [[CORBA]], [[Internet Communications Engine]], or [[OSGi]].


Sun's vice-president Rich Green said that Sun's ideal role with regard to Java was as an ''evangelist''.<ref>{{cite web|url=http://onjava.com/pub/a/onjava/2002/04/17/evangelism.html|title=Sun's Evolving Role as Java Evangelist|publisher=[[O'Reilly Media]]|archive-url=https://web.archive.org/web/20100915162748/http://onjava.com/pub/a/onjava/2002/04/17/evangelism.html|archive-date=September 15, 2010|url-status=live|access-date=August 2, 2009
===Object orientation===
}}</ref> Following [[Oracle Corporation]]'s acquisition of Sun Microsystems in 2009–10, Oracle has described itself as the steward of Java technology with a relentless commitment to fostering a community of participation and transparency.<ref>{{cite web |url=https://www.oracle.com/us/technologies/java/|title=Oracle and Java|work=oracle.com|publisher=Oracle Corporation |access-date=2010-08-23|quote=Oracle has been a leading and substantive supporter of Java since its emergence in 1995 and takes on the new role as steward of Java technology with a relentless commitment to fostering a community of participation and transparency. |url-status=dead|archive-url=https://web.archive.org/web/20100131091008/http://www.oracle.com/us/technologies/java/ |archive-date=January 31, 2010}}</ref> This did not prevent Oracle from filing a lawsuit against Google shortly after that for using Java inside the [[Android SDK]] (see the ''[[#Android|Android]]'' section).
The first characteristic, [[object-oriented programming|object orientation]] ("OO"), refers to a method of programming and language design.
Although there are many interpretations of OO, one primary distinguishing idea is to design software so that the various types of data it manipulates are combined together with their relevant operations. Thus, data and code are combined into entities called [[Object (computer science)|objects]]. An object can be thought of as a self-contained bundle of ''behavior'' (code) and ''state'' (data). The principle is to separate the things that change from the things that stay the same; often, a change to some data structure requires a corresponding change to the code that operates on that data, or vice versa. This separation into coherent objects provides a more stable foundation for a software system's design. The intent is to make large software projects easier to manage, thus improving quality and reducing the number of failed projects.


On April 2, 2010, James Gosling resigned from [[Oracle Corporation|Oracle]].<ref>{{cite web|url=http://nighthacks.com/roller/jag/entry/time_to_move_on |title=Time to move on... |last=Gosling |first=James |date=April 9, 2010 |work=On a New Road |access-date=2011-11-16 |author-link=James Gosling |url-status=dead |archive-url=https://web.archive.org/web/20101105031239/http://nighthacks.com/roller/jag/entry/time_to_move_on |archive-date=November 5, 2010}}</ref>
Another primary goal of OO programming is to develop more generic objects so that software can become more reusable between projects. A generic "customer" object, for example, should in theory have roughly the same basic set of behaviors between different software projects, especially when these projects overlap on some fundamental level as they often do in large organizations. In this sense, software objects can hopefully be seen more as pluggable [[software componentry|components]], helping the software industry build projects largely from existing and well tested pieces, thus leading to a massive reduction in development times. Software reusability has met with mixed practical results, with two main difficulties: the design of truly generic objects is poorly-understood, and a methodology for broad communication of reuse opportunities is lacking. Some open source communities want to help ease the reuse problem, by providing authors with ways to disseminate information about generally reusable objects and object libraries.


In January 2016, Oracle announced that Java run-time environments based on JDK 9 will discontinue the browser plugin.<ref>{{cite web|url=https://blogs.oracle.com/java-platform-group/entry/moving_to_a_plugin_free|title=Moving to a Plugin-Free Web|first=Dalibor|last=Topic|access-date=March 15, 2016|archive-url=https://web.archive.org/web/20160316164325/https://blogs.oracle.com/java-platform-group/entry/moving_to_a_plugin_free|archive-date=March 16, 2016|url-status=live}}</ref>
===Platform independence===
[[Image:SwingSet.png|thumb|The [[look and feel]] of Java Swing [[Graphical user interface|GUI]]s is independent of the platform on which they are running]]
The second characteristic, [[Cross-platform|platform independence]], means that [[computer program|program]]s written in the Java language must run similarly on diverse hardware. One should be able to write a program once and run it anywhere.


Java software runs on most devices from laptops to [[data center]]s, [[Video game console|game consoles]] to scientific [[supercomputer]]s.<ref>{{cite web|title=Learn About Java Technology|url=http://www.java.com/en/about/|publisher=Oracle|access-date=November 21, 2011|archive-url=https://web.archive.org/web/20111124090716/http://www.java.com/en/about/|archive-date=November 24, 2011|url-status=live}}</ref>
This is achieved by most Java [[compiler]]s by compiling the Java language code "halfway" to [[bytecode]] (specifically [[Java bytecode]])&mdash;simplified machine instructions specific to the Java platform. The code is then run on a [[virtual machine]] (VM), a program written in native code on the host hardware that [[Interpreter (computing)|interprets]] and executes generic Java bytecode. Further, standardized libraries are provided to allow access to features of the host machines (such as graphics, [[thread (computer science)|threading]] and [[Computer network|networking]]) in unified ways. Note that, although there's an explicit compiling stage, at some point, the Java bytecode is [[Interpreter (computing)|interpreted]] or converted to native [[assembly language|machine instructions]] by the [[Just-in-time compilation|JIT compiler]].


[[Oracle Corporation|Oracle]] (and others) highly recommend uninstalling outdated and unsupported versions of Java, due to unresolved security issues in older versions.<ref>{{Cite web|url=https://www.java.com/en/download/faq/remove_olderversions.xml|title=Why should I uninstall older versions of Java from my system?|publisher=Oracle|access-date=2021-09-24|archive-date=February 12, 2018|archive-url=https://web.archive.org/web/20180212011608/https://java.com/en/download/faq/remove_olderversions.xml|url-status=live}}</ref>
There are also implementations of Java compilers that compile to native [[object code]], such as [[GCJ]], removing the intermediate bytecode stage, but the output of these compilers can only be run on a single [[Computer architecture|architecture]].


=== Principles ===
Sun's license for Java insists that all implementations be "compatible". This resulted in a legal dispute with Microsoft after Sun claimed that the Microsoft implementation did not support the RMI and JNI interfaces and had added platform-specific features of their own. Sun sued and won both damages (some $20 million) and a court order enforcing the terms of the license from Sun. In response, Microsoft no longer ships Java with Windows, and in recent versions of Windows, Internet Explorer cannot support Java applets without a third-party plugin. However, Sun and others have made available Java run-time systems at no cost for those and other versions of Windows.
There were five primary goals in creating the Java language:<ref name="design_goals" />
<!-- these are quoted directly from the source, please do not remove or change any of them! -->
# It must be simple, [[object-oriented programming|object-oriented]], and familiar.
# It must be [[Robustness (computer science)|robust]] and secure.
# It must be architecture-neutral and portable.
# It must execute with high performance.
# It must be [[Interpreter (computing)|interpreted]], [[thread (computing)|threaded]], and [[Dynamic programming language|dynamic]].


=== Versions ===
The first implementations of the language used an interpreted virtual machine to achieve [[Porting|portability]]. These implementations produced programs that ran more slowly than programs written in C or C++, so the language suffered a reputation for poor performance. More recent JVM implementations produce programs that run significantly faster than before, using multiple techniques.
{{Main|Java version history}}
{{As of|2024|11}}, Java 8, 11, 17, and 21 are supported as [[long-term support]] (LTS) versions, with Java 25, releasing in September 2025, as the next scheduled LTS version.<ref>{{cite web |title=Oracle Java SE Support Roadmap |publisher=Oracle |date=September 13, 2021 |url=https://www.oracle.com/java/technologies/java-se-support-roadmap.html|access-date=September 18, 2021|archive-url=https://web.archive.org/web/20210919090451/https://www.oracle.com/java/technologies/java-se-support-roadmap.html |archive-date=2021-09-19|url-status=live}}</ref>


Oracle released the last zero-cost public update for the [[legacy system|legacy]] version [[Java 8]] LTS in January 2019 for commercial use, although it will otherwise still support Java&nbsp;8 with public updates for personal use indefinitely. Other vendors such as [[Adoptium]] continue to offer free builds of OpenJDK's long-term support (LTS) versions. These builds may include additional security patches and bug fixes.<ref>{{cite web |title=Temurin™ Support; Adoptium |url=https://adoptium.net/support/ |website=adoptium.net |access-date=29 March 2024 |archive-url=https://web.archive.org/web/20240329061257/https://adoptium.net/support/ |archive-date=29 March 2024 |url-status=live}}</ref>
The first technique is to simply compile directly into native code like a more traditional compiler, skipping bytecodes entirely. This achieves good performance, but at the expense of portability. Another technique, known as ''just-in-time compilation'' (JIT), translates the Java bytecodes into native code at the time that the program is run. More sophisticated VMs use ''[[dynamic recompilation]]'', in which the VM can analyze the behavior of the running program and selectively recompile and optimise critical parts of the program. Dynamic recompilation can achieve optimizations superior to static compilation because the dynamic compiler can base optimizations on knowledge about the runtime environment and the set of loaded classes. JIT compilation and dynamic recompilation allow Java programs to take advantage of the speed of native code without losing portability.


Major release versions of Java, along with their release dates:
Portability is a technically difficult goal to achieve, and Java's success at that goal has been mixed. Although it is indeed possible to write programs for the Java platform that behave consistently across many host platforms, the large number of available platforms with small errors or inconsistencies led some to parody Sun's "[[Write once, run anywhere]]" slogan as "Write once, [[debug]] everywhere".


{| class="wikitable"
Platform-independent Java is however very successful with server-side applications, such as [[Web service]]s, [[servlet]]s, and [[Enterprise JavaBean]]s, as well as with [[Embedded system]]s based on [[OSGi]], using [[Embedded Java]] environments.
! Version !! Date
|-
| JDK [[beta version|Beta]] || 1995
|-
| JDK 1.0 || January 23, 1996<ref>{{cite web|url=http://www.sun.com/smi/Press/sunflash/1996-01/sunflash.960123.10561.xml |title=JAVASOFT SHIPS JAVA 1.0|website=sun.com |access-date=2008-02-05 |url-status=dead |archive-url=https://web.archive.org/web/20070310235103/http://www.sun.com/smi/Press/sunflash/1996-01/sunflash.960123.10561.xml |archive-date=March 10, 2007}}</ref>
|-
| JDK 1.1 || February 19, 1997
|-
| J2SE 1.2 || December 8, 1998
|-
| J2SE 1.3 || May 8, 2000
|-
| J2SE 1.4 || February 6, 2002
|-
| J2SE 5.0 || September 30, 2004
|-
| Java SE 6 || December 11, 2006
|-
| Java SE 7 || July 28, 2011
|-
| Java SE 8 (LTS) || March 18, 2014
|-
| Java SE 9 || September 21, 2017
|-
| Java SE 10 || March 20, 2018
|-
| Java SE 11 (LTS) || September 25, 2018<ref>{{cite news|url=https://blogs.oracle.com/java-platform-group/introducing-java-se-11|title=Introducing Java SE 11|first=Sharat|last=Chander|website=oracle.com|access-date=September 26, 2018|archive-url=https://web.archive.org/web/20180926093144/https://blogs.oracle.com/java-platform-group/introducing-java-se-11|archive-date=September 26, 2018|url-status=live}}</ref>
|-
| Java SE 12 || March 19, 2019
|-
| Java SE 13 || September 17, 2019
|-
| Java SE 14 || March 17, 2020
|-
| Java SE 15 || September 15, 2020<ref>{{cite news|url=https://blogs.oracle.com/java-platform-group/the-arrival-of-java-15|title=The Arrival of Java 15!|date=September 15, 2020|publisher=[[Oracle Corporation|Oracle]]|access-date=2020-09-15|archive-date=September 16, 2020|archive-url=https://web.archive.org/web/20200916092332/https://blogs.oracle.com/java-platform-group/the-arrival-of-java-15|url-status=live |last1=Chander |first1=Sharat }}</ref>
|-
| Java SE 16 || March 16, 2021
|-
| Java SE 17 (LTS) || September 14, 2021
|-
| Java SE 18 || March 22, 2022
|-
| Java SE 19 || September 20, 2022
|-
| Java SE 20 || March 21, 2023
|-
| Java SE 21 (LTS) || September 19, 2023<ref>{{Cite web|url=https://openjdk.org/projects/jdk/21/|title=JDK 21|website=openjdk.org|access-date=September 20, 2023|archive-date=September 20, 2023|archive-url=https://web.archive.org/web/20230920173515/https://openjdk.org/projects/jdk/21/|url-status=live}}</ref>
|-
| Java SE 22 || March 19, 2024
|-
| Java SE 23 || September 17, 2024
|-
| Java SE 24 || 18 March 2025<ref name="jdk24">{{cite web | url=https://openjdk.org/projects/jdk/24/ | title=JDK 24 }}</ref>
|}


== Editions ==
===Automatic garbage collection===
{{See also|Free Java implementations#Class library}}
One possible argument against languages such as [[C++]] is that programmers should be spared the burden of having to perform manual [[memory management]]. In C++, the programmer must allocate memory to create any object stored on the [[heap (programming)|heap]], and deallocate memory to delete any such objects. If a programmer forgets to deallocate memory or writes code that fails to do so in a timely fashion, a [[memory leak]] can occur: the program will consume a potentially arbitrarily large amount of memory. In addition, if a region of memory is deallocated twice, the program can become unstable and may crash.
{{Java platforms}}
Sun has defined and supports four editions of Java targeting different application environments and segmented many of its [[application programming interface|APIs]] so that they belong to one of the platforms. The platforms are:
* [[Java Card]] for smart-cards.<ref name="java_card">{{cite web |url=https://www.oracle.com/technetwork/java/embedded/javacard/overview/ |title=Java Card Overview |publisher=Oracle |work=Oracle Technology Network |access-date=December 18, 2014 |archive-url=https://web.archive.org/web/20150107034738/http://www.oracle.com/technetwork/java/embedded/javacard/overview/ |archive-date=January 7, 2015 |url-status=live}}</ref>
* [[Java Platform, Micro Edition]] (Java ME) – targeting environments with limited resources.<ref name="java_me">{{cite web |url=https://www.oracle.com/technetwork/java/embedded/javame/ |title=Java Platform, Micro Edition (Java ME) |publisher=Oracle |work=Oracle Technology Network |access-date=December 18, 2014 |archive-url=https://web.archive.org/web/20150104210546/http://www.oracle.com/technetwork/java/embedded/javame/ |archive-date=January 4, 2015 |url-status=live}}</ref>
* [[Java Platform, Standard Edition]] (Java SE) – targeting workstation environments.<ref name="java_se">{{cite web |url=https://www.oracle.com/technetwork/java/javase/overview/ |title=Java SE |publisher=Oracle |work=Oracle Technology Network |access-date=December 18, 2014 |archive-url=https://web.archive.org/web/20141224184532/http://www.oracle.com/technetwork/java/javase/overview/ |archive-date=December 24, 2014 |url-status=live}}</ref>
* [[Java Platform, Enterprise Edition]] (Java EE) – targeting large distributed enterprise or Internet environments.<ref name="java_ee">{{cite web |url=https://www.oracle.com/technetwork/java/javaee/overview/ |title=Java Platform, Enterprise Edition (Java EE) |publisher=Oracle |work=Oracle Technology Network |access-date=December 18, 2014 |archive-url=https://web.archive.org/web/20141217155326/http://www.oracle.com/technetwork/java/javaee/overview/ |archive-date=December 17, 2014 |url-status=live}}</ref>


The [[Class (computer programming)|classes]] in the Java APIs are organized into separate groups called [[Java package|packages]]. Each package contains a set of related [[Interface (Java)|interfaces]], classes, subpackages and [[exception handling|exceptions]].
In Java, this potential problem is avoided by [[garbage collection (computer science)|automatic garbage collection]]. The programmer determines when objects are created and the Java runtime is responsible for managing the [[Object lifetime|objects' lifecycle]]. The program or other objects can reference an object by holding a reference to it (which, from a low-level point of view, is its address on the heap). When no references to an object remain, the Java garbage collector automatically deletes the [[unreachable object]], freeing memory and preventing a memory leak. Memory leaks may still occur if a programmer's code holds a reference to an object that is no longer needed&mdash;in other words, they can still occur but at higher conceptual levels. On the whole, Java's automatic garbage collection makes creation and deletion of objects in Java simpler, potentially safer, and often faster than in C++.


Sun also provided an edition called [[PersonalJava|Personal Java]] that has been superseded by later, standards-based Java ME configuration-profile pairings.
Garbage collection in Java is virtually invisible to the developer. That is, developers may have no notion of when garbage collection will take place as it may not necessarily correlate with any actions being explicitly performed by the code they write.


== Execution system ==
Note that memory is only one of many resources which must be managed.
=== Java JVM and bytecode ===
{{Main|Java (software platform)|Java virtual machine}}
<!-- we apparently have two main sections for what seems to be the same thing. Merge needed? -->


One design goal of Java is [[software portability|portability]], which means that programs written for the Java platform must run similarly on any combination of hardware and operating system with adequate run time support. This is achieved by compiling the Java language code to an intermediate representation called [[Java bytecode]], instead of directly to architecture-specific [[machine code]]. Java bytecode instructions are analogous to machine code, but they are intended to be executed by a [[virtual machine]] (VM) written specifically for the host hardware. [[End user|End-users]] commonly use a [[Java virtual machine|Java Runtime Environment]] (JRE) installed on their device for standalone Java applications or a web browser for [[Java applet]]s.
==Syntax==
{{Main|Java syntax}}


Standard libraries provide a generic way to access host-specific features such as graphics, [[thread (computing)|threading]], and [[Computer network|networking]].
The syntax of Java is largely derived from C++. But unlike C++, which combines the syntax for structured, generic, and object-oriented programming, Java was built from the ground up to be fully object-oriented. Everything in Java is an object (with a few exceptions), and everything in Java is written inside a class.


The use of universal bytecode makes porting simple. However, the overhead of [[Interpreter (computing)|interpreting]] bytecode into machine instructions made interpreted programs almost always run more slowly than native [[executable]]s. [[Just-in-time compilation|Just-in-time]] (JIT) compilers that compile byte-codes to machine code during runtime were introduced from an early stage. Java's Hotspot compiler is actually two compilers in one; and with [[GraalVM]] (included in e.g. Java 11, but removed as of Java 16) allowing [[tiered compilation]].<ref>{{Cite web |date=2021-08-06 |title=Deep Dive Into the New Java JIT Compiler – Graal {{!}} Baeldung |url=https://www.baeldung.com/graal-java-jit-compiler |access-date=2021-10-13 |website=www.baeldung.com |language=en-US |archive-date=October 28, 2021 |archive-url=https://web.archive.org/web/20211028165746/https://www.baeldung.com/graal-java-jit-compiler |url-status=live }}</ref> Java itself is platform-independent and is adapted to the particular platform it is to run on by a [[Java virtual machine]] (JVM), which translates the [[Java bytecode]] into the platform's machine language.<ref>{{cite web|url=http://www.programmerinterview.com/index.php/java-questions/jvm-platform-dependent/|title=Is the JVM (Java Virtual Machine) platform dependent or platform independent? What is the advantage of using the JVM, and having Java be a translated language?|publisher=Programmer Interview|access-date=2015-01-19|archive-url=https://web.archive.org/web/20150119144223/http://www.programmerinterview.com/index.php/java-questions/jvm-platform-dependent/ |archive-date=January 19, 2015|url-status=live}}</ref>
===Hello world===
:''For an explanation of the tradition of programming "Hello World" see: [[Hello world program]].''


====Stand-alone application====
==== Performance ====
{{Main|Java performance}}
// Hello.java
public class Hello {
public static void main(String[] args) {
System.out.println("Hello, world!");
}
}


Programs written in Java have a reputation for being slower and requiring more memory than those written in [[C++]].<ref name=Jelovic>{{cite web |title=Why Java will always be slower than C++ |last=Jelovic |first=Dejan |url=http://www.jelovic.com/articles/why_java_is_slow.htm |access-date=2008-02-15 |url-status=dead |archive-url=https://web.archive.org/web/20080211111923/http://www.jelovic.com/articles/why_java_is_slow.htm |archive-date=February 11, 2008}}</ref><ref>{{cite web |last=Hundt |first=Robert |title=Loop Recognition in C++/Java/Go/Scala |url=https://days2011.scala-lang.org/sites/days2011/files/ws3-1-Hundt.pdf |access-date=2012-07-12 |url-status=live |archive-url=https://web.archive.org/web/20111116151424/https://days2011.scala-lang.org/sites/days2011/files/ws3-1-Hundt.pdf |archive-date=November 16, 2011}}</ref> However, Java programs' execution speed improved significantly with the introduction of [[just-in-time compilation]] in 1997/1998 for [[Java version history|Java&nbsp;1.1]],<ref>{{cite web |url=http://www.symantec.com/about/news/release/article.jsp?prid=19970407_03 |title=Symantec's Just-In-Time Java Compiler To Be Integrated into Sun JDK 1.1 |access-date=August 1, 2009 |archive-url=https://web.archive.org/web/20100628171748/http://www.symantec.com/about/news/release/article.jsp?prid=19970407_03 |archive-date=June 28, 2010 |url-status=dead}}</ref> the addition of language features supporting better code analysis (such as inner classes, the StringBuilder class, optional assertions, etc.), and optimizations in the Java virtual machine, such as [[HotSpot (virtual machine)|HotSpot]] becoming Sun's default JVM in 2000. With Java&nbsp;1.5, the performance was improved with the addition of the {{code|java.util.concurrent}} package, including [[lock-free]] implementations of the [[Java ConcurrentMap|ConcurrentMaps]] and other multi-core collections, and it was improved further with Java&nbsp;1.6.
The above example merits a bit of explanation.
* Everything in Java is written inside a class, including stand-alone programs.
* Source files are by convention named the same as the class they contain, appending the mandatory suffix ''.java''. A <code>'''class'''</code> which is declared <code>'''public'''</code> is required to follow this convention. (In this case, the class is <code>'''Hello'''</code>, therefore the source must be stored in a file called ''Hello.java'').
* The compiler will generate a class file for each class defined in the source file. The name of the class file is the name of the class, with ''.class'' appended. For class file generation, anonymous classes are treated as if their name was the concatenation of the name of their enclosing class, a ''$'', and an integer.
* Programs to be executed as stand-alone must have a <code>'''main()'''</code> method.
* The [[Java keywords|keyword]] <code>'''void'''</code> indicates that the main method does not return anything.
* The main method must accept an [[array]] of '''{{Javadoc:SE|java/lang|String}}''' objects. By convention, it is referenced as <code>'''args'''</code> although any other legal identifier name can be used.
* The keyword <code>'''static'''</code> indicates that the method is a [[class method]], associated with the class rather than object instances. Main methods must be static.
* The keyword <code>'''public'''</code> denotes that a method can be called from code in other classes, or that a class may be used by classes outside the class hierarchy. Main methods must also be public.
* The printing facility is part of the Java standard library: The '''{{Javadoc:SE|java/lang|System}}''' class defines a public static field called '''{{Javadoc:SE|name=out|java/lang|System|out}}'''. The <code>out</code> object is an instance of the {{Javadoc:SE|java/io|PrintStream}} class and provides the method '''{{Javadoc:SE|name=println(String)|java/io|PrintStream|println(java.lang.String)}}''' for displaying data to the screen ([[standard streams|standard out]]).
* Standalone programs are run by giving the Java runtime the name of the class whose main method is to be invoked. For example, at a [[Unix]] command line <code>java -cp . Hello</code> will start the above program (compiled into ''Hello.class'') from the current directory. The name of the class whose main method is to be invoked can also be specified in the ''MANIFEST'' of a [[Jar (file format)|Java archive (Jar) file]].


====Applet====
=== Non-JVM ===
Some platforms offer direct hardware support for Java; there are micro controllers that can run Java bytecode in hardware instead of a software Java virtual machine,<ref>{{Cite journal|last1=Salcic|first1=Zoran|last2=Park|first2=Heejong|last3=Teich|first3=Jürgen|last4=Malik|first4=Avinash|last5=Nadeem|first5=Muhammad|date=2017-07-22|title=Noc-HMP: A Heterogeneous Multicore Processor for Embedded Systems Designed in SystemJ|journal=ACM Transactions on Design Automation of Electronic Systems |volume=22|issue=4|pages=73|doi=10.1145/3073416|s2cid=11150290|issn=1084-4309}}</ref> and some [[ARM architecture family|ARM]]-based processors could have hardware support for executing Java bytecode through their [[Jazelle]] option, though support has mostly been dropped in current implementations of ARM.
[[Java applet]]s are programs that are embedded in other applications, typically in a Web page displayed in a [[Web browser]].


=== Automatic memory management ===
// Hello.java
Java uses an [[Garbage collection (computer science)|automatic garbage collector]] to manage memory in the [[object lifetime|object lifecycle]]. The programmer determines when objects are created, and the Java runtime is responsible for recovering the memory once objects are no longer in use. Once no references to an object remain, the [[unreachable memory]] becomes eligible to be freed automatically by the garbage collector. Something similar to a [[memory leak]] may still occur if a programmer's code holds a reference to an object that is no longer needed, typically when objects that are no longer needed are stored in containers that are still in use.{{sfn|Bloch|2018|loc=§Item 7: Eliminate obsolete object references|p=26-28}} If methods for a non-existent object are called, a [[null pointer]] exception is thrown.<ref>{{cite web |url=http://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html |title=NullPointerException |publisher=Oracle |access-date=2014-05-06 |archive-url=https://web.archive.org/web/20140506214735/http://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html |archive-date=May 6, 2014 |url-status=live}}</ref><ref>{{cite web |url=http://www.artima.com/designtechniques/exceptions.html |title=Exceptions in Java |publisher=Artima.com |access-date=2010-08-10 |archive-url=https://web.archive.org/web/20090121152332/http://www.artima.com/designtechniques/exceptions.html |archive-date=January 21, 2009 |url-status=live}}</ref>
import java.applet.Applet;
import java.awt.Graphics;
public class Hello extends Applet {
public void paint(Graphics gc) {
gc.drawString("Hello, world!", 65, 95);
}
}


One of the ideas behind Java's automatic memory management model is that programmers can be spared the burden of having to perform manual memory management. In some languages, memory for the creation of objects is implicitly allocated on the [[Stack (abstract data type)|stack]] or explicitly allocated and deallocated from the [[Memory management#DYNAMIC|heap]]. In the latter case, the responsibility of managing memory resides with the programmer. If the program does not deallocate an object, a [[memory leak]] occurs.{{sfn|Bloch|2018|loc=§Item 7: Eliminate obsolete object references|p=26-28}} If the program attempts to access or deallocate memory that has already been deallocated, the result is undefined and difficult to predict, and the program is likely to become unstable or crash. This can be partially remedied by the use of [[smart pointer]]s, but these add overhead and complexity. Garbage collection does not prevent [[logical address|logical memory]] leaks, i.e. those where the memory is still referenced but never used.{{sfn|Bloch|2018|loc=§Item 7: Eliminate obsolete object references|p=26-28}}
&lt;!-- Hello.html --&gt;
<html>
<head>
<title>Hello World Applet</title>
</head>
<body>
<applet code="Hello" width="200" height="200">
</applet>
</body>
</html>


Garbage collection may happen at any time. Ideally, it will occur when a program is idle. It is guaranteed to be triggered if there is insufficient free memory on the heap to allocate a new object; this can cause a program to stall momentarily. Explicit memory management is not possible in Java.
The '''<code>import</code>''' statements direct the [[Java compiler]] to include the '''{{Javadoc:SE|package=java.applet|java/applet|Applet}}''' and '''{{Javadoc:SE|package=java.awt|java/awt|Graphics}}''' classes in the compilation. The import statement allows these classes to be referenced in the [[source code]] using the ''simple class name'' (i.e. <code>Applet</code>) instead of the ''fully-qualified class name'' (i.e. <code>java.applet.Applet</code>).


Java does not support C/C++ style [[pointer (computer programming)|pointer arithmetic]], where object addresses can be arithmetically manipulated (e.g. by adding or subtracting an offset). This allows the garbage collector to relocate referenced objects and ensures type safety and security.
The <code>'''Hello'''</code> class <code>'''extends'''</code> ([[subclass (computer science)|subclasses]]) the '''<code>Applet</code>''' class; the <code>Applet</code> class provides the framework for the host application to display and control the [[Object lifetime|lifecycle]] of the applet. The <code>Applet</code> class is an [[Abstract Windowing Toolkit]] (AWT) {{Javadoc:SE|java/awt|Component}}, which provides the applet with the capability to display a [[graphical user interface]] (GUI) and respond to user [[event-driven programming|events]].


As in C++ and some other object-oriented languages, variables of Java's [[primitive data type]]s are either stored directly in fields (for objects) or on the [[Stack-based memory allocation|stack]] (for methods) rather than on the heap, as is commonly true for non-primitive data types (but see [[escape analysis]]). This was a conscious decision by Java's designers for performance reasons.
The <code>Hello</code> class [[method overriding (programming)|overrides]] the '''{{Javadoc:SE|name=paint(Graphics)|java/awt|Container|paint(java.awt.Graphics)}}''' method inherited from the {{Javadoc:SE|java/awt|Container}} [[superclass (computer science)|superclass]] to provide the code to display the applet. The <code>paint()</code> method is passed a '''<code>Graphics</code>''' object that contains the graphic context used to display the applet. The <code>paint()</code> method calls the graphic context '''{{Javadoc:SE|name=drawString(String, int, int)|java/awt|Graphics|drawString(java.lang.String,%20int,%20int)}}''' method to display the '''"Hello, world!"''' string at a [[pixel]] offset of (<code>'''65, 95'''</code>) in the applet's display.


Java contains multiple types of garbage collectors. Since Java 9, HotSpot uses the [[Garbage-first collector|Garbage First Garbage Collector]] (G1GC) as the default.<ref>{{cite web |url=https://docs.oracle.com/javase/7/docs/technotes/guides/vm/performance-enhancements-7.html |title=Java HotSpot™ Virtual Machine Performance Enhancements |publisher=Oracle.com |access-date=2017-04-26 |archive-url=https://web.archive.org/web/20170529071720/http://docs.oracle.com/javase/7/docs/technotes/guides/vm/performance-enhancements-7.html |archive-date=May 29, 2017 |url-status=live}}</ref> However, there are also several other garbage collectors that can be used to manage the heap, such as the Z Garbage Collector (ZGC) introduced in Java 11, and Shenandoah GC, introduced in Java 12 but unavailable in Oracle-produced OpenJDK builds. Shenandoah is instead available in third-party builds of OpenJDK, such as [[Adoptium#Eclipse Temurin|Eclipse Temurin]]. For most applications in Java, G1GC is sufficient. In prior versions of Java, such as Java 8, the [https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/parallel.html Parallel Garbage Collector] was used as the default garbage collector.
An applet is placed in an [[HTML]] document using the '''<code><applet></code>''' [[HTML element]]. The <code>applet</code> tag has three attributes set: '''<code>code="Hello"</code>''' specifies the name of the <code>Applet</code> class and '''<code>width="200" height="200"</code>''' sets the pixel width and height of the applet. (Applets may also be embedded in HTML using either the <code>object</code> or <code>embed</code> element, although support for these elements by Web browsers is inconsistent.[http://java.sun.com/docs/books/tutorial/deployment/applet/applettag.html][http://java.sun.com/docs/books/tutorial/deployment/applet/mixedbrowser.html])


Having solved the memory management problem does not relieve the programmer of the burden of handling properly other kinds of resources, like network or database connections, file handles, etc., especially in the presence of exceptions.
====Servlet====
[[Java servlet]]s are [[server-side]] Java EE components that generate responses to requests from [[client (computing)|client]]s.


== Syntax ==
// Hello.java
{{Main|Java syntax}}
import java.io.*;
[[File:JavaUniverse.png|thumb|upright|This dependency graph of the Java Core classes was created with jdeps and [[Gephi]].]]
import javax.servlet.*;
The syntax of Java is largely influenced by [[C++]] and [[C (programming language)|C]]. Unlike C++, which combines the syntax for structured, generic, and object-oriented programming, Java was built almost exclusively as an object-oriented language.<ref name="design_goals" /> All code is written inside classes, and every data item is an object, with the exception of the primitive data types, (i.e. integers, floating-point numbers, [[Boolean data type|boolean values]], and characters), which are not objects for performance reasons. Java reuses some popular aspects of C++ (such as the {{java|printf}} method).
public class Hello extends GenericServlet {
public void service(ServletRequest request, ServletResponse response)
throws ServletException, IOException
{
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
pw.println("Hello, world!");
pw.close();
}
}


Unlike C++, Java does not support [[operator overloading]]<ref name="msdn_operator_overloading">{{cite web |url=http://msdn.microsoft.com/en-us/library/ms228498%28v=vs.90%29.aspx |title=Operator Overloading (C# vs Java) |publisher=Microsoft |work=C# for Java Developers |access-date=December 10, 2014 |archive-url=https://web.archive.org/web/20150107190007/http://msdn.microsoft.com/en-us/library/ms228498(v=vs.90).aspx |archive-date=January 7, 2015 |url-status=live}}</ref> or [[multiple inheritance]] for classes, though multiple inheritance is supported for [[interface (Java)|interfaces]].<ref name="oracle_multiple_inheritance">{{cite web |url=https://docs.oracle.com/javase/tutorial/java/IandI/multipleinheritance.html |title=Multiple Inheritance of State, Implementation, and Type |publisher=Oracle |work=The Java Tutorials |access-date=December 10, 2014 |archive-url=https://web.archive.org/web/20141109034520/https://docs.oracle.com/javase/tutorial/java/IandI/multipleinheritance.html |archive-date=November 9, 2014 |url-status=live}}</ref>
The '''<code>import</code>''' statements direct the Java compiler to include all of the public classes and [[interface (Java)|interfaces]] from the '''{{Javadoc:SE|package=java.io|java/io}}''' and '''{{Javadoc:EE|package=javax.servlet|javax/servlet}}''' [[Java package|packages]] in the compilation.


Java uses [[Comment (computer programming)|comments]] similar to those of C++. There are three different styles of comments: a single line style marked with two slashes (<code>//</code>), a multiple line style opened with <code>/*</code> and closed with <code>*/</code>, and the [[Javadoc]] commenting style opened with <code>/**</code> and closed with <code>*/</code>. The Javadoc style of commenting allows the user to run the Javadoc executable to create documentation for the program and can be read by some [[integrated development environment]]s (IDEs) such as [[Eclipse (software)|Eclipse]] to allow developers to access documentation within the IDE.
The <code>'''Hello'''</code> class <code>'''extends'''</code> the '''{{Javadoc:EE|javax/servlet|GenericServlet}}''' class; the <code>GenericServlet</code> class provides the interface for the [[server (computing)|server]] to forward requests to the servlet and control the servlet's lifecycle.


=== Hello world ===
The <code>Hello</code> class overrides the '''{{Javadoc:EE|name=service(ServletRequest, ServletResponse)|javax/servlet|Servlet|service(javax.servlet.ServletRequest,javax.servlet.ServletResponse)}}''' method defined by the {{Javadoc:EE|javax/servlet|Servlet}} [[Interface (Java)|interface]] to provide the code for the service request handler. The <code>service()</code> method is passed a '''{{Javadoc:EE|javax/servlet|ServletRequest}}''' object that contains the request from the client and a '''{{Javadoc:EE|javax/servlet|ServletResponse}}''' object used to create the response returned to the client. The <code>service()</code> method declares that it <code>'''throws'''</code> the [[exception handling|exceptions]] {{Javadoc:EE|javax/servlet|ServletException}} and {{Javadoc:SE|java/io|IOException}} if a problem prevents it from responding to the request.
The following is a simple example of a [["Hello, World!" program]] that writes a message to the [[standard output]]:
<syntaxhighlight lang="java" line="1">public class Example {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}</syntaxhighlight>


== Special classes ==
The '''{{Javadoc:EE|name=setContentType(String)|javax/servlet|ServletResponse|setContentType(java.lang.String)}}''' method in the response object is called to set the [[MIME]] content type of the returned data to '''"text/html"'''. The '''{{Javadoc:EE|name=getWriter()|javax/servlet|ServletResponse|getWriter()}}''' method in the response returns a '''{{Javadoc:SE|java/io|PrintWriter}}''' object that is used to write the data that is sent to the client. The '''{{Javadoc:SE|name=println(String)|java/io|PrintWriter|println(java.lang.String)}}''' method is called to write the '''"Hello, world!"''' string to the response and then the '''{{Javadoc:SE|name=close()|java/io|PrintWriter|close()}}''' method is called to close the print writer, which causes the data that has been written to the stream to be returned to the client.
{{more citations needed|section|date=May 2019}}


====Swing application====
=== Applet ===
{{Main|Java applet}}
[[Swing (Java)|Swing]] is the advanced graphical user interface [[library (computer science)|library]] for the Java SE platform.
Java applets were programs embedded in other applications, mainly in web pages displayed in web browsers. The Java applet API was deprecated with the release of Java&nbsp;9 in 2017.<ref>{{Cite web |url=https://www.oracle.com/technetwork/java/javase/9-deprecated-features-3745636.html#JDK-8074165|title=Deprecated APIs, Features, and Options| publisher=Oracle |access-date=2019-05-31|archive-date=June 19, 2019|archive-url=https://web.archive.org/web/20190619200811/https://www.oracle.com/technetwork/java/javase/9-deprecated-features-3745636.html#JDK-8074165|url-status=live}}</ref><ref>{{Cite web|title=Applet (Java Platform SE 7)|url=https://docs.oracle.com/javase/7/docs/api/java/applet/Applet.html|website=Docs |publisher=Oracle |access-date=2020-05-01 |archive-date=August 2, 2020 |archive-url=https://web.archive.org/web/20200802033524/https://docs.oracle.com/javase/7/docs/api/java/applet/Applet.html |url-status=live}}</ref>


=== Servlet ===
// Hello.java
{{Main|Java servlet}}
import javax.swing.*;
[[Java servlet]] technology provides Web developers with a simple, consistent mechanism for extending the functionality of a Web server and for accessing existing business systems. Servlets are [[server-side]] Java EE components that generate responses to requests from [[client (computing)|clients]]. Most of the time, this means generating [[HTML]] pages in response to [[Hypertext Transfer Protocol|HTTP]] requests, although there are a number of other standard servlet classes available, for example for [[WebSocket]] communication.
public class Hello extends JFrame {
Hello() {
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
add(new JLabel("Hello, world!"));
pack();
}
public static void main(String[] args) {
new Hello().setVisible(true);
}
}


The Java servlet API has to some extent been superseded (but still used under the hood) by two standard Java technologies for web services:
The '''<code>import</code>''' statement directs the Java compiler to include all of the public classes and interfaces from the '''{{Javadoc:SE|package=javax.swing|javax/swing}}''' package in the compilation.
* the [[Java API for RESTful Web Services]] (JAX-RS 2.0) useful for AJAX, JSON and REST services, and
* the [[Java API for XML Web Services]] (JAX-WS) useful for [[SOAP]] [[Web Service]]s.


Typical implementations of these APIs on Application Servers or Servlet Containers use a standard servlet for handling all interactions with the [[HTTP]] requests and responses that delegate to the web service methods for the actual business logic.
The <code>'''Hello'''</code> class <code>'''extends'''</code> the '''{{Javadoc:SE|javax/swing|JFrame}}''' class; the <code>JFrame</code> class implements a [[window (computing)|window]] with a [[title bar]] with a close [[Widget (computing)|control]].


=== JavaServer Pages ===
The <code>'''Hello()'''</code> [[constructor (computer science)|constructor]] initializes the frame by first calling the '''{{Javadoc:SE|name=setDefaultCloseOperation(int)|javax/swing|JFrame|setDefaultCloseOperation(int)}}''' method inherited from <code>JFrame</code> to set the default operation when the close control on the title bar is selected to <code>'''{{Javadoc:SE|javax/swing|WindowConstants|DISPOSE_ON_CLOSE}}'''</code>&mdash;this causes the <code>JFrame</code> to be disposed of when the frame is closed (as opposed to merely hidden), which allows the JVM to exit and the program to terminate. Next a '''<code>new </code>{{Javadoc:SE|javax/swing|JLabel}}''' is created for the string '''"Hello, world!"''' and the '''{{Javadoc:SE|name=add(Component)|java/awt|Container|add(java.awt.Component)}}''' method inherited from the {{Javadoc:SE|java/awt|Container}} superclass is called to add the label to the frame. The '''{{Javadoc:SE|name=pack()|java/awt|Window|pack()}}''' method inherited from the {{Javadoc:SE|java/awt|Window}} superclass is called to size the window and [[layout]] its contents.
{{Main|JavaServer Pages}}
JavaServer Pages ([[Jakarta Server Pages|JSP]]) are [[server-side]] Java EE components that generate responses, typically [[HTML]] pages, to [[Hypertext Transfer Protocol|HTTP]] requests from [[client (computing)|clients]]. JSPs embed Java code in an HTML page by using the special [[delimiter]]s <code><%</code> and <code>%></code>. A JSP is compiled to a Java ''servlet'', a Java application in its own right, the first time it is accessed. After that, the generated servlet creates the response.<ref>{{Cite web|title=What Is a JSP Page? - The Java EE 5 Tutorial|url=https://docs.oracle.com/javaee/5/tutorial/doc/bnagy.html|website=docs.oracle.com|access-date=2020-05-01|archive-date=August 2, 2020|archive-url=https://web.archive.org/web/20200802003029/https://docs.oracle.com/javaee/5/tutorial/doc/bnagy.html|url-status=live}}</ref>


=== Swing application ===
The <code>'''main()'''</code> method is called by the JVM when the program starts. It [[Instance (programming)|instantiates]] a '''<code>new Hello</code>''' frame and causes it to be displayed by calling the '''{{Javadoc:SE|name=setVisible(boolean)|java/awt|Component|setVisible(boolean)}}''' method inherited from the {{Javadoc:SE|java/awt|Component}} superclass with the boolean parameter <code>'''true'''</code>. Note that once the frame is displayed, exiting the <code>main</code> method does not cause the program to terminate because the AWT [[event dispatching thread]] remains active until all of the Swing top-level windows have been disposed.
{{Main|Swing (Java)}}
[[Swing (Java)|Swing]] is a graphical user interface [[library (computing)|library]] for the Java SE platform. It is possible to specify a different look and feel through the [[pluggable look and feel]] system of Swing. Clones of [[Microsoft Windows|Windows]], [[GTK+]], and [[Motif (software)|Motif]] are supplied by Sun. [[Apple Inc.|Apple]] also provides an [[Aqua (user interface)|Aqua]] look and feel for [[macOS]]. Where prior implementations of these looks and feels may have been considered lacking, Swing in Java SE 6 addresses this problem by using more native [[Graphical control element|GUI widget]] drawing routines of the underlying platforms.<ref>{{Cite web|title=Trail: Creating a GUI With JFC/Swing (The Java Tutorials)|url=https://docs.oracle.com/javase/tutorial/uiswing/|website=docs.oracle.com|access-date=2020-05-01|archive-date=April 29, 2020|archive-url=https://web.archive.org/web/20200429104302/https://docs.oracle.com/javase/tutorial/uiswing/|url-status=live}}</ref>


=== JavaFX application ===
==Criticism==
{{Main|JavaFX}}
Java was intended to serve as a novel way to manage software complexity. Most consider Java technology to deliver reasonably well on this promise. However, Java is not without flaws, and it does not universally accommodate all programming styles, environments, or requirements.
[[JavaFX]] is a [[Computing platform|software platform]] for creating and delivering [[Application software|desktop applications]], as well as [[rich web application]]s that can run across a wide variety of devices. JavaFX is intended to replace [[Swing (Java)|Swing]] as the standard [[graphical user interface]] (GUI) library for [[Java Platform, Standard Edition|Java SE]], but since JDK 11 JavaFX has not been in the core JDK and instead in a separate module.<ref>{{Cite web|title=Removed from JDK 11, JavaFX 11 arrives as a standalone module |work=InfoWorld |date=September 20, 2018 |url=https://www.infoworld.com/article/3305073/removed-from-jdk-11-javafx-11-arrives-as-a-standalone-module.html|access-date=2020-10-13|archive-date=October 14, 2020|archive-url=https://web.archive.org/web/20201014141716/https://www.infoworld.com/article/3305073/removed-from-jdk-11-javafx-11-arrives-as-a-standalone-module.html|url-status=live}}</ref> JavaFX has support for [[desktop computer]]s and [[web browser]]s on [[Microsoft Windows]], [[Linux]], and [[macOS]]. JavaFX does not have support for native OS look and feels.<ref>{{Cite web|title=Getting Started with JavaFX: Hello World, JavaFX Style |work=JavaFX 2 Tutorials and Documentation|url=https://docs.oracle.com/javafx/2/get_started/hello_world.htm |publisher=Oracle |access-date=2020-05-01|archive-date= August 2, 2020 |archive-url=https://web.archive.org/web/20200802013650/https://docs.oracle.com/javafx/2/get_started/hello_world.htm|url-status=live}}</ref>


===General===
=== Generics ===
{{Main|Generics in Java}}
* Java failed to deliver industry standard arithmetic capabilities. The [[IEEE 754]] ''Standard for Binary Floating-Point Arithmetic'' had appeared in 1985 and has remained an industry standard since then. While Java's floating point arithmetic is largely based on the standard, certain features are not supported. Details about this kind of criticism can be found below in the external links section.
* Java's semi-proprietary nature, supposed inflexibility to change, and growing entrenchment in the corporate sector, have caused some to refer to Java as "the new [[COBOL]]". Many consider this to be a somewhat hyperbolic assertion, although it does allude to some legitimate concerns with Java's prospects for the future.
* Java's garbage collection manages only memory resources, and the time at which [[finalizer]]s are called cannot be controlled by the programmer. Therefore objects that reserve external resources must still be disposed of manually (sometimes using the "finally" mechanism), or kept until the program terminates.


In 2004, [[generic programming|generics]] were added to the Java language, as part of J2SE 5.0. Prior to the introduction of generics, each variable declaration had to be of a specific type. For container classes, for example, this is a problem because there is no easy way to create a container that accepts only specific types of objects. Either the container operates on all subtypes of a class or interface, usually <code>Object</code>, or a different container class has to be created for each contained class. Generics allow compile-time type checking without having to create many container classes, each containing almost identical code. In addition to enabling more efficient code, certain runtime exceptions are prevented from occurring, by issuing compile-time errors. If Java prevented all runtime type errors (<code>ClassCastException</code>s) from occurring, it would be [[type safety|type safe]].
===Language===
* Java can be considered a less pure object-oriented programming language than for instance [[Ruby programming language|Ruby]] or [[Smalltalk]] because it makes certain compromises (such as the fact that not all values are objects) for performance reasons. The distinction between [[reference (computer science)|reference]] types and [[primitive type]]s may be viewed as artificial.
* Conversely, [[C++]] programmers can become confused with Java because in Java primitives are always [[Automatic memory allocation|automatic variables]] and objects always reside on the [[Dynamic memory allocation|heap]], whereas C++ programmers are explicitly given the choice in both cases by means of [[operator new]].
* Java code is often more verbose than code written in other languages. This is due in part to its frequent type declarations and manual casts. It is also due to the lack of [[operator overloading]] (see below) and the relatively simple syntax. However, J2SE 5.0 introduced [[Generic programming|Generics]] which addresses the issue of manual casts, as well as new syntax for foreach-loops which also reduces verbosity.
* Unlike C++, Java does not support user-definable [[operator overloading]]; however, this is a deliberate design decision, seen by many as a plus because of the well-known readability and [[software maintenance|maintenance]] problems experienced with operator overloading.
* Java is predominantly a single-[[programming paradigm|paradigm]] language. Historically, it has not been very accommodating of paradigms other than object-oriented programming. As of J2SE 5.0, the procedural paradigm is somewhat better supported in Java with the addition of the ability to ''import static'' methods and fields so that they can be referenced without prepending the class name.
* Java only supports [[single inheritance]] of implementation unlike the orthogonal [[multiple inheritance]] that is available in many other languages. However, Java employs [[interface (Java)|interface]]s, which allow multiple inheritance of type and [[abstract method]]s.
* Java's support of text matching and manipulation is not as strong as languages such as [[Perl]], [[Ruby programming language|Ruby]], or [[PHP]], although [[regular expression]]s were introduced in J2SE 1.4.
* Java lacks what [[delphi programming language|delphi]] and [[C sharp|C#]] refer to as properties. That is, members of a class that look to the class user like fields but can call code to get and set the value. Properties make use of objects more natural (no ''get'' and ''set'' methods) while still allowing side effects to be added later.


In 2016, the type system of Java was proven [[soundness|unsound]] in that it is possible to use generics to construct classes and methods that allow assignment of an instance of one class to a variable of another unrelated class. Such code is accepted by the compiler, but fails at run time with a class cast exception.<ref>{{cite web|url=https://raw.githubusercontent.com/namin/unsound/master/doc/unsound-oopsla16.pdf|title=Java and Scala's Type Systems are Unsound|access-date=February 20, 2017 |archive-url=https://web.archive.org/web/20161128174902/https://raw.githubusercontent.com/namin/unsound/master/doc/unsound-oopsla16.pdf |archive-date=November 28, 2016|url-status=live}}</ref>
===Look and feel===
The look and feel of [[Graphical User Interface|GUI]] applications written in Java using the [[Swing (Java)|Swing]] platform is often different from native applications. While programmers can choose to use the [[Abstract Windowing Toolkit|AWT toolkit]] that displays native widgets (and thus look like the operating platform), the AWT toolkit is unable to meet advanced GUI programming needs by wrapping around advanced widgets and not sacrificing portability across the various supported platforms, each of which have vastly different APIs especially for higher-level widgets. The Swing toolkit, written completely in Java, avoids this problem by reimplementing widgets using only the most basic drawing mechanisms that are guaranteed available on all platforms. The drawback is that extra effort is required to resemble the operating platform. While this is possible (using the GTK+ and [[Microsoft Windows|Windows]] Look-and-Feel), most users do not know how to change the default Metal Look-And-Feel to one that resembles their native platform, and as a result they are stuck with Java applications that look and feel different from their native applications. Of note however, [[Apple Computer]]'s own optimized version of the Java Runtime, which is included within the [[Mac OS X]] distribution, by default implements its "[[Aqua (GUI)|Aqua]]" look-and-feel, giving Swing applications on the [[Macintosh]] a similar appearance to native software.


===Performance===
== Criticism ==
{{Main|Criticism of Java}}
It is misleading to make any generalization about the performance of Java programs, because runtime performance is affected much more by the quality of the compiler or [[Java virtual machine|JVM]] than by any intrinsic properties of the language itself. [[Java bytecode]] can either be interpreted at run time by a virtual machine, or can be compiled at load time or runtime into machine code which runs directly on the computer's hardware. Interpretation is slower than native execution, and compilation at load time or runtime has an initial performance penalty for the compilation.
Criticisms directed at Java include the implementation of generics,<ref>{{cite web
|last=Arnold
|first=Ken
|date=June 27, 2005
|title=Generics Considered Harmful
|url=https://weblogs.java.net/blog/arnold/archive/2005/06/generics_consid_1.html
|publisher=java.net
|access-date=September 10, 2015
|url-status=dead
|archive-url=https://web.archive.org/web/20071010002142/http://weblogs.java.net/blog/arnold/archive/2005/06/generics_consid_1.html
|archive-date=October 10, 2007
}}</ref> speed,<ref name=Jelovic /> the handling of unsigned numbers,<ref>{{cite web
|last=Owens |first=Sean R.
|url=http://darksleep.com/player/JavaAndUnsignedTypes.html
|archive-url=https://web.archive.org/web/20090220171410/http://darksleep.com/player/JavaAndUnsignedTypes.html
|archive-date=February 20, 2009
|title=Java and unsigned int, unsigned short, unsigned byte, unsigned long, etc. (Or rather, the lack thereof)
|access-date=2011-07-04
}}</ref> the implementation of floating-point arithmetic,<ref>{{cite web
|last=Kahan
|first=William
|date=March 1, 1998
|title=How Java's Floating-Point Hurts Everyone Everywhere – ACM 1998 Workshop on Java (Stanford)
|url=http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf
|publisher=Electrical Engineering & Computer Science, University of California at Berkeley
|access-date=June 4, 2011
|archive-url=https://web.archive.org/web/20120905004527/http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf
|archive-date=September 5, 2012
|url-status=live
}}</ref> and a history of security vulnerabilities in the primary Java VM implementation [[HotSpot (virtual machine)|HotSpot]].<ref>{{cite web
|url=http://blogs.technet.com/b/mmpc/archive/2010/10/18/have-you-checked-the-java.aspx
|title=Have you checked the Java?
|access-date=December 23, 2011
|archive-url=https://web.archive.org/web/20120921140402/http://blogs.technet.com/b/mmpc/archive/2010/10/18/have-you-checked-the-java.aspx
|archive-date=September 21, 2012
|url-status=dead
}}</ref>
Developers have criticized the complexity and verbosity of the Java Persistence API (JPA), a standard part of Java EE. This has led to increased adoption of higher-level abstractions like Spring Data JPA, which aims to simplify database operations and reduce boilerplate code. The growing popularity of such frameworks suggests limitations in the standard JPA implementation's ease-of-use for modern Java development.<ref>{{cite book
|last=Chidester
|first=Ashlan
|title=Java Persistence API, Jenkins and AWS
|url=https://www.vlebooks.com/vleweb/product/openreader?id=none&isbn=9798224253951
|access-date=September 16, 2024
|isbn=9798224253951
}}</ref>


== Class libraries ==
There are a few language requirements which incur an unavoidable time penalty, although these features are not unique to Java. Among these are array bounds checking, run-time type checking, and virtual function indirection. Also the lack of features can affect performance. For example, Java doesn't have arrays of stuctures or a true multi-dimensional array, but only an array of references to objects or further arrays. Nor does Java allow returning more than one value from a function without using an object. The net result is that Java code makes more heap allocations than well-written code in some other languages.
{{Main|Java Class Library}}
The [[Java Class Library]] is the [[standard library]], developed to support application development in Java. It is controlled by [[Oracle Corporation|Oracle]] in cooperation with others through the [[Java Community Process]] program.<ref>{{Citation|last=Cadenhead|first=Rogers|title=Understanding How Java Programs Work|date=2017-11-20|url=http://www.informit.com/articles/article.aspx?p=2832404&seqNum=4|access-date=2019-03-26|archive-date=August 13, 2021|archive-url=https://web.archive.org/web/20210813193850/https://www.informit.com/articles/article.aspx?p=2832404&seqNum=4|url-status=live}}</ref> Companies or individuals participating in this process can influence the design and development of the APIs. This process has been a subject of controversy during the 2010s.<ref>{{Cite news|url=https://www.theguardian.com/technology/2016/may/26/google-wins-copyright-lawsuit-oracle-java-code|title=Google wins six-year legal battle with Oracle over Android code copyright|last=Woolf|first=Nicky|date=2016-05-26|work=The Guardian|access-date=2019-03-26|language=en-GB|issn=0261-3077|archive-date=March 26, 2019|archive-url=https://web.archive.org/web/20190326203847/https://www.theguardian.com/technology/2016/may/26/google-wins-copyright-lawsuit-oracle-java-code|url-status=live}}</ref> The class library contains features such as:
* The core libraries, which include:
** [[Input/output]] (I/O or IO){{sfn|Bloch|2018|loc=§&nbsp;1 Introduction|pp=1-4}} and [[Non-blocking I/O (Java)|non-blocking I/O]] (NIO), or IO/NIO<ref>{{Cite web|url=https://docs.oracle.com/javase/8/docs/api/java/nio/package-summary.html|title=java.nio (Java Platform SE 8)|website=docs.oracle.com}}</ref>
** [[Computer network|Networking]]<ref>{{Cite web|url=https://docs.oracle.com/javase/8/docs/technotes/guides/net/|title=Java Networking|website=docs.oracle.com}}</ref> (new [[user agent]] (HTTP client) since Java 11<ref>{{Cite web|url=https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.html|title=HttpClient (Java SE 11 & JDK 11)|website=docs.oracle.com}}</ref>)
** [[Reflective programming]] (reflection)
** [[Concurrent computing]] (concurrency){{sfn|Bloch|2018|loc=§&nbsp;1 Introduction|pp=1-4}}
** [[Generics in Java|Generics]]
** Scripting, Compiler
** [[Functional programming]] ([[Lambda (programming)|Lambda]], streaming)
** [[Java collections framework|Collection libraries]] that implement [[data structure]]s such as [[List (abstract data type)|lists]], [[associative array|dictionaries]], [[tree structure|trees]], [[Set (abstract data type)|sets]], [[Queue (abstract data type)|queues]] and [[double-ended queue]], or [[Stack (abstract data type)|stacks]]<ref name="collections">{{cite web |url=http://docs.oracle.com/javase/8/docs/technotes/guides/collections/overview.html |title=Collections Framework Overview |publisher=Oracle |work=Java Documentation |access-date=December 18, 2014 |archive-url=https://web.archive.org/web/20141231132540/http://docs.oracle.com/javase/8/docs/technotes/guides/collections/overview.html |archive-date=December 31, 2014 |url-status=live}}</ref>
** [[XML]] Processing (Parsing, Transforming, Validating) libraries
** [[Computer security|Security]]<ref name="security">{{cite web |url=http://docs.oracle.com/javase/8/docs/technotes/guides/security/overview/jsoverview.html |title=Java Security Overview |publisher=Oracle |work=Java Documentation |access-date=December 18, 2014 |archive-url=https://web.archive.org/web/20150103045031/http://docs.oracle.com/javase/8/docs/technotes/guides/security/overview/jsoverview.html |archive-date=January 3, 2015 |url-status=live}}</ref>
** [[Internationalization and localization]] libraries<ref name="i18n">{{cite web |url=http://docs.oracle.com/javase/tutorial/i18n/ |title=Trail: Internationalization |publisher=Oracle |work=The Java Tutorials |access-date=December 18, 2014 |archive-url=https://web.archive.org/web/20141231053232/http://docs.oracle.com/javase/tutorial/i18n/ |archive-date=December 31, 2014 |url-status=live}}</ref>
* The integration libraries, which allow the application writer to communicate with external systems. These libraries include:
** The [[Java Database Connectivity]] (JDBC) [[Application programming interface|API]] for database access
** [[Java Naming and Directory Interface]] (JNDI) for lookup and discovery
** [[Java remote method invocation]] (RMI) and [[Common Object Request Broker Architecture]] (CORBA) for distributed application development
** [[Java Management Extensions]] (JMX) for managing and monitoring applications
* [[User interface]] libraries, which include:
** The (heavyweight, or [[Native (computing)|native]]) [[Abstract Window Toolkit]] (AWT), which provides [[graphical user interface|GUI]] components, the means for laying out those components and the means for handling events from those components
** The (lightweight) [[Swing (Java)|Swing]] libraries, which are built on AWT but provide (non-native) implementations of the AWT widgetry
** APIs for audio capture, processing, and playback
** [[JavaFX]]
* A platform dependent implementation of the Java virtual machine that is the means by which the bytecodes of the Java libraries and third-party applications are executed
* Plugins, which enable [[Java applet|applets]] to be run in web browsers
* [[Java Web Start]], which allows Java applications to be efficiently distributed to [[end user]]s across the Internet
* Licensing and documentation


== Documentation ==
The use of a [[Garbage collection (computer science)|garbage collector]] to automatically delete objects adds overhead compared to manual deallocation can have a positive or negative impact, or no discernable impact at all, on performance depending upon the garbage collector implementation and the characteristics of the application's use of objects. With the modern generational garbage collectors used in many JVMs, many applications actually experience greater performance because of faster [[dynamic memory allocation|allocation and deallocation]] algorithms.
{{Main|Javadoc}}


Javadoc is a comprehensive documentation system, created by [[Sun Microsystems]]. It provides developers with an organized system for documenting their code. Javadoc comments have an extra asterisk at the beginning, i.e. the delimiters are <code>/**</code> and <code>*/</code>, whereas the normal multi-line comments in Java are delimited by <code>/*</code> and <code>*/</code>, and single-line comments start with <code>//</code>.<ref name="javadoc_comments">{{cite web |url=https://www.oracle.com/technetwork/articles/java/index-137868.html |title=How to Write Doc Comments for the Javadoc Tool |publisher=Oracle |work=Oracle Technology Network |access-date=December 18, 2014 |archive-url=https://web.archive.org/web/20141218182906/http://www.oracle.com/technetwork/articles/java/index-137868.html |archive-date=December 18, 2014 |url-status=live}}</ref>
Relative performance of [[JIT compiler]]s as compared to native compilers can be quite close, and is often a subject of debate. The JIT compilation stage may be time consuming, which is inconvenient for applications that are short-lived and/or contain large amounts of code. Once compiled to native code, however, the performance of the program can be comparable to that achieved by a native compiler, even on numerical tasks. Although Java does not support manual [[inlining]] of method calls, many JIT compilers perform this optimization at load time and can exploit information from the runtime environment to guide more effective transformations, such as profile-directed inlining. Dynamic recompilation, as provided by Sun's [[HotSpot]] JVM, can exceed the performance of the static compilation available in most other languages by exploiting information that is only available at runtime.


== Implementations ==
Java was designed with an emphasis on security and portability, and does not support direct access to the machine architecture and address space. Java does not support [[inline assembly]] language, however, applications can drop down to native code to access these features using [[Java Native Interface]] (JNI) libraries.
{{See also|Free Java implementations|List of Java compilers}}
{{More citations needed|section|date=September 2023}}
[[Oracle Corporation]] owns the official implementation of the Java SE platform, due to its acquisition of [[Sun Microsystems]] on January 27, 2010. This implementation is based on the original implementation of Java by Sun. The Oracle implementation is available for [[Microsoft Windows|Windows]], [[macOS]], [[Linux]], and [[Solaris (operating system)|Solaris]]. Because Java lacks any formal standardization recognized by [[Ecma International]], ISO/IEC, ANSI, or other third-party standards organizations, the Oracle implementation is the [[de facto standard]].


The Oracle implementation is packaged into two different distributions: The Java Runtime Environment (JRE) which contains the parts of the Java SE platform required to run Java programs and is intended for end users, and the [[Java Development Kit]] (JDK), which is intended for software developers and includes development tools such as the [[Java compiler]], [[Javadoc]], [[JAR (file format)|Jar]], and a [[debugger]]. Oracle has also released [[GraalVM]], a high performance Java dynamic compiler and interpreter.
==Resources==


[[OpenJDK]] is another Java SE implementation that is licensed under the GNU GPL. The implementation started when Sun began releasing the Java source code under the GPL. As of Java SE 7, OpenJDK is the official Java reference implementation.
===Java Runtime Environment===
The '''[[Java Runtime Environment]]''' or '''JRE''' is the software required to run any [[Application software|application]] deployed on the Java Platform. [[End-user]]s commonly use a JRE in [[software package]]s and Web browser [[plugin]]s. Sun also distributes a superset of the JRE called the Java 2 [[SDK]] (more commonly known as the JDK), which includes development tools such as the Java [[compiler]], [[Javadoc]], and [[debugger]].


The goal of Java is to make all implementations of Java compatible. Historically, Sun's trademark license for usage of the Java brand insists that all implementations be ''compatible''. This resulted in a legal dispute with [[Microsoft]] after Sun claimed that the Microsoft implementation did not support [[Java remote method invocation]] (RMI) or [[Java Native Interface]] (JNI) and had added platform-specific features of their own. Sun sued in 1997, and, in 2001, won a settlement of US$20&nbsp;million, as well as a court order enforcing the terms of the license from Sun.<ref>{{cite news |last1=Niccolai |first1=James |date=2001-01-24 |title=Sun, Microsoft settle Java lawsuit |url=https://www.infoworld.com/article/2074908/sun-microsoft-settle-java-lawsuit.html |work=[[JavaWorld]] |agency=[[IDG News Service]] |access-date=2020-07-13 |archive-date=July 14, 2020 |archive-url=https://web.archive.org/web/20200714001541/https://www.infoworld.com/article/2074908/sun-microsoft-settle-java-lawsuit.html |url-status=live}}</ref> As a result, Microsoft no longer ships Java with [[Microsoft Windows|Windows]].
====Components====
* Java [[Library (computer science)|libraries]] that are the compiled [[byte code]]s of [[source code]] developed by the JRE implementor to support application development in Java. Examples of these libraries are:
** The core libraries, which include:
*** Collection libraries which implement [[data structure]]s such as [[list]]s, [[associative array|dictionaries]], [[tree structure|trees]] and [[Set (computer science)|sets]]
*** [[XML]] [[Parsing]] libraries
*** Security
*** [[i18n|Internationalization and localization]] libraries
** The integration libraries, which allow the application writer to communicate with external systems. These libraries include:
*** The [[Java Database Connectivity]] (JDBC) [[Application Programming Interface|API]] for database access
*** [[Java Naming and Directory Interface]] (JNDI) for lookup and discovery
*** [[Java remote method invocation|RMI]] and [[CORBA]] for distributed application development
** [[User Interface]] libraries, which include:
*** The (heavyweight, or [[native mode|native]]) [[Abstract Windowing Toolkit]] (AWT), which provides [[graphical user interface|GUI]] components, the means for laying out those components and the means for handling events from those components
*** The (lightweight) [[Swing (Java)|Swing]] libraries, which are built on AWT but provide (non-native) implementations of the AWT widgetry
*** APIs for audio capture, processing, and playback
* A platform dependent implementation of [[Java virtual machine]] (JVM) which is the means by which the byte codes of the Java libraries and third party applications are executed
* Plugins, which enable [[Java applet|applet]]s to be run in [[Web browser]]s
* [[Java Web Start]], which allows Java applications to be efficiently distributed to [[end user]]s across the [[Internet]]
* Licensing and documentation


Platform-independent Java is essential to [[Java Platform, Enterprise Edition|Java EE]], and an even more rigorous validation is required to certify an implementation. This environment enables portable server-side applications.
===APIs===
Sun has defined three platforms targeting different application environments and segmented many of its [[application programming interface|API]]s so that they belong to one of the platforms. The platforms are:
* [[Java Platform, Micro Edition]] (Java ME) &mdash; targeting environments with limited resources,
* [[Java Platform, Standard Edition]] (Java SE) &mdash; targeting workstation environments, and
* [[Java Platform, Enterprise Edition]] (Java EE) &mdash; targeting large distributed enterprise or Internet environments.


== Use outside the Java platform ==
The [[Class (computer science)|classes]] in the Java APIs are organized into separate groups called [[Java package|packages]]. Each package contains a set of related [[Interface (Java)|interface]]s, classes and [[exception handling|exceptions]]. Refer to the separate platforms for a description of the packages available.
The Java programming language requires the presence of a software platform in order for compiled programs to be executed.


Oracle supplies the [[Java platform]] for use with Java. The [[Android SDK]] is an alternative software platform, used primarily for developing [[Android application]]s with its own GUI system.
The set of APIs is controlled by Sun Microsystems in cooperation with others through the [[Java Community Process]] program. Companies or individuals participating in this process can influence the design and development of the APIs. This process has been a subject of controversy.


=== Android ===
In 2004, IBM and BEA publicly supported the notion of creating an official open source implementation of Java but as of 2006, Sun Microsystems has refused that.
The Java language is a key pillar in [[Android (operating system)|Android]], an [[open source software|open source]] [[mobile operating system]]. Although Android, built on the [[Linux kernel]], is written largely in C, the [[Android software development#SDK|Android SDK]] uses the Java language as the basis for Android applications but does not use any of its standard GUI, SE, ME or other established Java standards.<ref>{{cite web
|url=http://www.javalobby.org/nl/archive/jlnews_20071113o.html
|title=Google Android: Initial Impressions and Criticism
|date=November 13, 2007
|last=van Gurp
|first=Jilles
|work=Javalobby
|quote=''Frankly, I don't understand why Google intends to ignore the vast amount of existing implementation out there. It seems like a bad case of "not invented here" to me. Ultimately, this will slow adoption. There are already too many Java platforms for the mobile world and this is yet another one''
|access-date=March 7, 2009
|archive-date=August 28, 2008
|archive-url=https://web.archive.org/web/20080828111808/http://www.javalobby.org/nl/archive/jlnews_20071113o.html
|url-status=usurped
}}</ref> The bytecode language supported by the Android SDK is incompatible with Java bytecode and runs on its own virtual machine, optimized for low-memory devices such as [[smartphone]]s and [[tablet computer]]s. Depending on the Android version, the bytecode is either interpreted by the [[Dalvik (software)|Dalvik virtual machine]] or compiled into native code by the [[Android Runtime]].


Android does not provide the full Java SE standard library, although the Android SDK does include an independent implementation of a large subset of it. It supports Java&nbsp;6 and some Java&nbsp;7 features, offering an implementation compatible with the standard library ([[Apache Harmony]]).
===Extensions and related architectures===
<!----------------------------------------------------------------------------------
Only list extensions and APIs developed under the Java Community Process here.
----------------------------------------------------------------------------------->
The [[Extension (computing)|extensions]] to standard Java are typically in <code>javax.*</code> packages. They are not included in the JDK or JRE. Extensions and architectures closely tied to the Java programming language include:
* [[Java Platform, Enterprise Edition|Java EE]] (previously J2EE) (Java Platform, Enterprise Edition&mdash;for distributed enterprise applications)
* [[Java Platform, Micro Edition|Java ME]] (previously J2ME) (Java Platform, Micro Edition&mdash;for PDAs and cellular phones)
* [[JMF]] (Java Media Framework)
* [[JNDI]] (Java Naming and Directory Interface)
* [[JSML]] (Java Speech API Markup Language)
* [[JDBC]] (Java Database Connectivity)
* [[Java Data Objects|JDO]] (Java Data Objects)
* [[Java Advanced Imaging|JAI]] (Java Advanced Imaging)
* [[JAIN]] (Java API for Integrated Networks)
* [[JDMK]] (Java Dynamic Management Kit)
* [[Jini]] (a network architecture for the construction of [[federated]] [[distributed system]]s)
* [[Jiro]]
* [[Java Card]]
* [[JavaSpaces]]
* [[Java Modeling Language|JML]] (Java Modeling Language)
* [[Java Metadata Interface|JMI]] (Java Metadata Interface)
* [[Java Management Extensions|JMX]] (Java Management Extensions)
* [[JavaServer Pages|JSP]] (JavaServer Pages)
* [[JavaServer Faces|JSF]] (JavaServer Faces)
* [[Java Native Interface|JNI]] (Java Native Interface)
* [[JXTA]] (Open Protocols for [[Peer-to-Peer]] (P2P) Virtual Network)
* [[Java 3D]] (A high level API for 3D graphics programming)
* [[Java OpenGL|JOGL]] (Java OpenGL&mdash;A low level API for 3D graphics programming, using [[OpenGL]])
* [[Lightweight Java Game Library|LWJGL]] (Light Weight Java Game Library&mdash;A low level API providing access to [[OpenGL]], [[OpenAL]] and various input devices)
* [[OSGi]] (Dynamic Service Management and Remote Maintenance)
<!----------------------------------------------------------------------------------
Only list extensions and APIs developed under the Java Community Process above.
----------------------------------------------------------------------------------->


== See also ==
==== Controversy ====
{{See also|Oracle America, Inc. v. Google, Inc.}}
* [[Java syntax]]
The use of Java-related technology in Android led to a legal dispute between Oracle and Google. On May 7, 2012, a San Francisco jury found that if APIs could be copyrighted, then Google had infringed Oracle's copyrights by the use of Java in Android devices.<ref>{{cite web |last=Mullin |first=Joe |title=Google guilty of infringement in Oracle trial; future legal headaches loom |url=https://arstechnica.com/tech-policy/news/2012/05/jury-rules-google-violated-copyright-law-google-moves-for-mistrial.ars |work=Law & Disorder |date=May 7, 2012 |publisher=Ars Technica |access-date=2012-05-08 |archive-url=https://web.archive.org/web/20120508134916/http://arstechnica.com/tech-policy/news/2012/05/jury-rules-google-violated-copyright-law-google-moves-for-mistrial.ars |archive-date=May 8, 2012 |url-status=live}}</ref> District Judge [[William Alsup]] ruled on May 31, 2012, that APIs cannot be copyrighted,<ref>{{cite web
* [[Java keywords]]
|title=Google wins crucial API ruling, Oracle's case decimated
* [[Java virtual machine]]
|url=https://arstechnica.com/tech/2012/05/google-wins-crucial-api-ruling-oracles-case-decimated/
* [[Java platform]]
|first=Joe
* [[Java applet]]
|last=Mullin
* [[Java Platform, Standard Edition]] (Java SE, J2SE)
|work=Ars Technica
* [[JavaOS]]
|date=May 31, 2012
* [[Comparison of Java and C++]]
|access-date=2012-06-01
* [[Comparison of C Sharp and Java|Comparison of C# and Java]]
|archive-url=https://web.archive.org/web/20170312065520/https://arstechnica.com/tech-policy/2012/05/google-wins-crucial-api-ruling-oracles-case-decimated/
* [[Java User Group]]
|archive-date=March 12, 2017
* [[Java Community Process]]
|url-status=live
* [[JavaOne]]
}}</ref> but this was reversed by the United States Court of Appeals for the Federal Circuit in May 2014.<ref name="cnet appeals">{{cite news |url=https://www.cnet.com/news/court-sides-with-oracle-over-android-in-java-patent-appeal/ |title=Court sides with Oracle over Android in Java patent appeal |work=CNET |date=May 9, 2014 |access-date=2014-05-10 |author=Rosenblatt, Seth |archive-url=https://web.archive.org/web/20140510203805/http://www.cnet.com/news/court-sides-with-oracle-over-android-in-java-patent-appeal/ |archive-date=May 10, 2014 |url-status=live}}</ref> On May 26, 2016, the district court decided in favor of Google, ruling the copyright infringement of the Java API in Android constitutes fair use.<ref>{{cite web |last1=Mullin |first1=Joe |title=Google beats Oracle—Android makes "fair use" of Java APIs |url=https://arstechnica.com/tech-policy/2016/05/google-wins-trial-against-oracle-as-jury-finds-android-is-fair-use/ |access-date=2016-05-26 |website=Ars Technica |date=2016-05-26 |archive-url=https://web.archive.org/web/20170120164551/http://arstechnica.com/tech-policy/2016/05/google-wins-trial-against-oracle-as-jury-finds-android-is-fair-use/ |archive-date=January 20, 2017 |url-status=live}}</ref> In March 2018, this ruling was overturned by the Appeals Court, which sent down the case of determining the damages to federal court in San Francisco.<ref>{{cite web
* [[Join Java|Join Java programming language]]
|title="Google's use of the Java API packages was not fair," appeals court rules
* [[Javapedia]]
|url=https://arstechnica.com/tech-policy/2018/03/googles-use-of-the-java-api-packages-was-not-fair-appeals-court-rules/
* [[Inferno (operating system)|Inferno operating system]]
|first=Cyrus
|last=Farivar
|work=Ars Technica
|date=March 27, 2018
|access-date=2019-08-06
|archive-date=September 24, 2019
|archive-url=https://web.archive.org/web/20190924081919/https://arstechnica.com/tech-policy/2018/03/googles-use-of-the-java-api-packages-was-not-fair-appeals-court-rules/
|url-status=live
}}</ref>
Google filed a petition for [[Certiorari|writ of certiorari]] with the [[Supreme Court of the United States]] in January 2019 to challenge the two rulings that were made by the Appeals Court in Oracle's favor.<ref>{{cite web |url=https://arstechnica.com/tech-policy/2019/01/google-asks-supreme-court-to-overrule-disastrous-ruling-on-api-copyrights/ |title=Google asks Supreme Court to overrule disastrous ruling on API copyrights |first=Timothy |last=Lee |date=April 23, 2019 |access-date=April 23, 2019 |work=[[Ars Technica]] |archive-date=April 23, 2019 |archive-url=https://web.archive.org/web/20190423084450/https://arstechnica.com/tech-policy/2019/01/google-asks-supreme-court-to-overrule-disastrous-ruling-on-api-copyrights/ |url-status=live}}</ref> On April 5, 2021, the Court ruled 6–2 in Google's favor, that its use of Java APIs should be considered [[fair use]]. However, the court refused to rule on the copyrightability of APIs, choosing instead to determine their ruling by considering Java's API copyrightable "purely for argument's sake."<ref>{{Cite web |url=https://www.supremecourt.gov/opinions/20pdf/18-956_d18f.pdf |title=''Google LLC v. Oracle America, Inc'' 593 U. S. ____ (2021) |access-date=April 6, 2021 |archive-date=April 5, 2021 |archive-url=https://web.archive.org/web/20210405140150/https://www.supremecourt.gov/opinions/20pdf/18-956_d18f.pdf |url-status=live}}</ref>


=== Lists ===
== See also ==
{{Portal|Computer programming}}
* [[List of Java-programs|List of articles with Java source code]]
* [[C Sharp (programming language)|C#]]
* [[List of Java scripting languages]]
* [[C++]]
* [[:Category:Java platform software|Java platform software]]
* [[Dalvik (software)|Dalvik]], used in old Android versions, replaced by non-JIT [[Android Runtime]]
* [[:Category:Java tools|Java development tools]]
* [[Java Heterogeneous Distributed Computing]]
* [[List of Java APIs]]
* [[List of Java frameworks]]
* [[List of JVM languages]]
* [[List of Java virtual machines]]
* [[List of Java virtual machines]]
* [[Comparison of C Sharp and Java|Comparison of C# and Java]]
* [[Comparison of Java and C++]]
* [[Comparison of programming languages]]


== References ==
== References ==
{{Reflist}}
* Jon Byous, [http://java.sun.com/features/1998/05/birthday.html ''Java technology: The early years'']. Sun Developer Network, no date [ca. 1998]. Retrieved [[April 22]], [[2005]].
* [[James Gosling]], [http://today.java.net/jag/old/green/ ''A brief history of the Green project'']. Java.net, no date [ca. Q1/1998]. Retrieved [[April 22]], [[2005]].
* [[James Gosling]], [[Bill Joy]], [[Guy L. Steele, Jr.|Guy Steele]], and [[Gilad Bracha]], ''The Java language specification'', third edition. Addison-Wesley, 2005. ISBN 0321246780.
* Tim Lindholm and Frank Yellin. ''The Java Virtual Machine specification'', second edition. Addison-Wesley, 1999. ISBN 0201432943.


== Notes ==
== Bibliography ==
{{Refbegin}}
# {{note|star7}} The device was named '''Star7''' after a telephone feature activated by '''*7''' on a telephone keypad, which enabled users to answer the telephone anywhere.
* {{Cite book |last=Bloch |first=Joshua |year=2018|title=Effective Java: Programming Language Guide |edition=Third |publisher=Addison-Wesley |isbn=978-0-13-468599-1}}
* {{Cite book |last1=Gosling |first1=James |last2=Joy |first2=Bill |author-link2=Bill Joy |last3=Steele |first3=Guy L. Jr. |author-link3=Guy L. Steele, Jr. |first4=Gilad |last4=Bracha |author-link4=Gilad Bracha |year=2005 |title=The Java Language Specification |url=https://java.sun.com/docs/books/jls/ |edition=3rd |publisher=Addison-Wesley |isbn=0-321-24678-0 |access-date=February 8, 2019 |archive-date=February 14, 2012 |archive-url=https://web.archive.org/web/20120214061826/http://java.sun.com/docs/books/jls/ |url-status=live}}
* {{Cite book |last1=Gosling |first1=James |last2=Joy |first2=Bill |last3=Steele |first3=Guy |last4=Bracha |first4=Gilad |last5=Buckley |first5=Alex |title=The Java® Language Specification |date=2014 |edition=Java SE 8 |url=https://docs.oracle.com/javase/specs/jls/se8/jls8.pdf |access-date=November 18, 2014 |archive-date=October 21, 2014 |archive-url=https://web.archive.org/web/20141021061951/http://docs.oracle.com/javase/specs/jls/se8/jls8.pdf |url-status=live}}
* {{Cite book |last1=Lindholm |first1=Tim |last2=Yellin |first2=Frank |year=1999 |title=The Java Virtual Machine Specification |url=https://java.sun.com/docs/books/vmspec/2nd-edition/html/VMSpecTOC.doc.html |edition=2nd |publisher=Addison-Wesley |isbn=0-201-43294-3 |access-date=February 8, 2019 |archive-date=September 25, 2011 |archive-url=https://web.archive.org/web/20110925050249/http://java.sun.com/docs/books/vmspec/2nd-edition/html/VMSpecTOC.doc.html |url-status=live}}
{{Refend}}


== External links ==
== External links ==
{{Sister project links |wikt=Java |display=Java |commons=Category:Java (programming language) |b=Java Programming |n=no |s=no |voy=no |species=no |v=Java |d=Q251}}
{{Wikibookspar|Programming|Java}}
{{Wikibookspar|Java Programming|Java}}
{{wikiversity|Java Platform, Enterprise Edition/Java EE Tutorial}}
* {{Official website|jdk.java.net}}, OpenJDK, Oracle
* [https://adoptium.net/ JDK builds, Adoptium]


{{Java (software platform)}}
=== Sun ===
{{Sun Microsystems}}
* [http://java.sun.com/ Official Java home site for IT, developers, etc]
{{Oracle}}
* [http://www.java.com/ Official Java home site non-technical / home-use]
{{Oracle FOSS}}
* [http://java.sun.com/docs/books/jls/ The Java Language Specification, Third Edition] Authoritative description of the Java language (also available [http://java.sun.com/docs/books/jls/third_edition/html/j3TOC.html online])
{{Programming languages}}
* {{Javadoc:SE}}
{{Authority control}}
* [http://java.sun.com/docs/books/tutorial/ Sun's tutorial on Java Programming]
* [http://java.sun.com/docs/white/langenv/ Original Java whitepaper], 1996
* [http://www.java.com/en/download/help/testvm.xml Test your Java VM]


[[Category:Java (programming language)| ]]
=== [[Java Specification Request]]s ===
[[Category:C programming language family]]
There are several JSRs related to the Java Language and core API packages.
[[Category:Class-based programming languages]]
* [http://www.jcp.org/en/jsr/detail?id=14 JSR 14] ''Add [[Generic programming|Generic Types]] To The Java Programming Language'' (J2SE 5.0)
[[Category:Concurrent programming languages]]
* [http://www.jcp.org/en/jsr/detail?id=41 JSR 41] ''A Simple Assertion Facility'' (J2SE 1.4)
* [http://www.jcp.org/en/jsr/detail?id=47 JSR 47] ''Logging API Specification'' (J2SE 1.4)
* [http://www.jcp.org/en/jsr/detail?id=51 JSR 51] ''[[New I/O]] APIs for the Java Platform'' (J2SE 1.4)
* [http://www.jcp.org/en/jsr/detail?id=59 JSR 59] ''J2SE Merlin Release Contents'' (J2SE 1.4)
* [http://www.jcp.org/en/jsr/detail?id=131 JSR 121] ''[[Application Isolation API]]'' (not yet included)
* [http://www.jcp.org/en/jsr/detail?id=133 JSR 133] ''Java Memory Model and Thread Specification Revision'' (J2SE 5.0)
* [http://www.jcp.org/en/jsr/detail?id=166 JSR 166] ''Concurrency Utilities'' (J2SE 5.0)
* [http://www.jcp.org/en/jsr/detail?id=175 JSR 175] ''[[A Metadata Facility for the Java Programming Language]]'' (J2SE 5.0)
* [http://www.jcp.org/en/jsr/detail?id=176 JSR 176] ''J2SE 5.0 (Tiger) Release Contents'' (J2SE 5.0)
* [http://www.jcp.org/en/jsr/detail?id=201 JSR 201] ''Extending the Java Programming Language with Enumerations, Autoboxing, Enhanced for loops and Static Import'' (J2SE 5.0)
* [http://www.jcp.org/en/jsr/detail?id=203 JSR 203] ''More New I/O APIs for the Java Platform ("NIO.2")'' (Java SE 7)
* [http://www.jcp.org/en/jsr/detail?id=204 JSR 204] ''Unicode Supplementary Character Support'' (J2SE 5.0) &ndash; support for [[Unicode]] 3.1
* [http://www.jcp.org/en/jsr/detail?id=270 JSR 270] ''Java SE 6 ("Mustang") Release Contents'' (Java SE 6)
* [http://www.jcp.org/en/jsr/detail?id=275 JSR 275] ''Physical Units/Quantities Support (Java SE) (reference implementation from [[JScience]])
* [http://www.jcp.org/en/jsr/detail?id=901 JSR 901] ''Java Language Specification'' (J2SE 5.0)

=== Tutorials ===
* [http://java.sun.com/docs/books/tutorial/ The Java Tutorial] from Sun Microsystems (online)
* David Flanagan, ''Java in a Nutshell, Third Edition''. O'Reilly & Associates, 1999. ISBN 1565924878
* [http://www.bruceeckel.com/ ''Thinking in Java''], by [[Bruce Eckel]] (online)
* [http://www.vias.org/javacourse/ ''Java Course''], by A.B. Downey, also known as an HTMLHelp based eBook
* [http://math.hws.edu/javanotes/ ''Introduction to Programming Using Java''] Online textbook by David J. Eck
* [http://ibiblio.org/obp/thinkCS/ How to Think Like a Computer Scientist] Java version
* [http://chortle.ccsu.edu/CS151/cs151java.html An introduction to Computer Science using Java] By Bradley Kjell. This text focuses on the principles and fundamentals of programming languages and computers in general, and uses Java as it's language of instruction.
* [http://www.alnaja7.net/Programmer/393/ITCS-393.htm A Java tutorial] by [[User:Alhoori|Hamed Alhoori]], instructor at the [[University Of Bahrain]].

=== Resources ===
* [http://www.alphaworks.ibm.com/java IBM AlphaWorks Java web site]
* [http://www.computer-books.us/java.php Computer-Books.us] A collection of Java books available for free download
* [http://wiki.java.net/bin/view/Javapedia/ Javapedia project]
* [http://wiki.java.net/bin/view/Main/WebHome The Java.net Wiki]
* [http://www.inesystems.com Sun Certification Resource]
* [http://www.javarss.com/ JavaRSS.com] Portal of Java websites
* [http://www.ibm.com/developerworks/java?ca=dgr-wikia-dW-JavaHP developerWorks Java Zone—Java resource community]
* [http://www.javawhat.com/ JavaWhat.com] Java resource directory

=== Java Integrated Development Environments ===
The following [[Integrated Development Environment]]s (IDEs) can be used to create Java programs.

<!-- Please keep the IDEs listed in alphabetical order. --->
* [http://www.bea.com/framework.jsp?CNT=index.htm&FP=/content/products/workshop/ BEA Workshop] &ndash; commercial software, developed by [[BEA Systems]], integrates with [[BEA WebLogic]]
* [http://www.bluej.org/ BlueJ] &ndash; [[free software]] developed as a joint university research project, [[BlueJ]] is also an interactive development environment suitable for learning Java
* [http://www.eclipse.org/ Eclipse] &ndash; free [[open source]] software, [[Eclipse (software)|Eclipse]] is developed by the [[Eclipse Foundation]]
* [http://www.jetbrains.com/idea/ IntelliJ IDEA] &ndash; commercial software, [[IntelliJ IDEA]] is developed by [[JetBrains]]
* [http://www.borland.com/us/products/jbuilder/index.html JBuilder] &ndash; commercial software (free version available), [[JBuilder]] is developed by [[Borland]]
* [http://www.jcreator.com/ JCreator] &ndash; commercial software (free version available), [[JCreator]] is developed by Xinox
* [http://www.oracle.com/tools/jdev_home.html JDeveloper] &ndash; free software [[JDeveloper]] is developed by [[Oracle Corporation]] and integrates with [[Oracle Application Server]]
* [http://www.netbeans.org/ NetBeans] &ndash; free open source software developed by [[NetBeans|NetBeans.org]]
* [http://developers.sun.com/prodtech/javatools/jsenterprise/index.html Sun Java Studio Enterprise] &ndash; commercial software (available free to members of the free Sun Developer Network), developed by Sun Microsystems
* [http://www-306.ibm.com/software/websphere/sw-bycategory/subcategory/SW710.html WebSphere Developer & Development Studio] &ndash; commercial software, developed by [[IBM]], integrates with [[WebSphere Application Server]]

=== History ===
* [http://java.sun.com/features/1998/05/birthday.html Java&trade; Technology: The Early Years]
* [http://java.sun.com/people/jag/green/ A Brief History of the Green Project]
* [http://www.cs.umd.edu/users/seanl/stuff/java-objc.html Java Was Strongly Influenced by Objective-C]
* [http://www.wired.com/wired/archive/3.12/java.saga.html The Java Saga]
* [http://java.sun.com/features/2000/06/time-line.html The Java Platform: Five Years in Review]
* [http://ei.cs.vt.edu/~wwwbtb/book/chap1/java_hist.html A history of Java]

=== Alternatives ===
* [http://www.blackdown.org Blackdown Java] for [[Linux]], includes [[Mozilla]] plugin
* [http://www.gnu.org/software/classpath/ GNU Classpath] from [[GNU]] - currently being [[Merge (revision control)|merged]] with libgcj of the [http://gcc.gnu.org/java/ GNU Compiler for Java]

=== Criticism ===
* [http://www.gnu.org/philosophy/java-trap.html Free But Shackled&mdash;The Java Trap], by [[Richard Stallman]], [[April 12]], [[2004]]. ([http://today.java.net/jag/page7.html#59 James Gosling's response])
* [http://www.research.att.com/~bs/bs_faq.html#Java Is Java the language you would have designed if you didn't have to be compatible with C?], by [[Bjarne Stroustrup]]
* [http://www.softpanorama.org/Lang/java.shtml Softpanorama Java Critique Page: Java vs Scripting Languages], by [[Nikolai Bezroukov]]
* [http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf How Java’s Floating-Point Hurts Everyone Everywhere], by [[W. Kahan und Joseph D. Darcy]] at the ''ACM 1998 Workshop on Java for High–Performance Network Computing''
* [http://www.paulgraham.com/javacover.html Java's Cover] by [[Paul Graham]]

{{featured article}}

{{Major programming languages small}}

[[Category:Java programming language| ]]
[[Category:Java platform|Programming language]]
[[Category:Java platform|Programming language]]
[[Category:Java specification requests|Programming language]]
[[Category:Java specification requests|Programming language]]
[[Category:C programming language family]]
[[Category:JVM programming languages]]
[[Category:Multi-paradigm programming languages]]
[[Category:Object-oriented programming languages]]
[[Category:Programming languages created in 1995]]
[[Category:Programming languages]]
[[Category:Programming languages]]
[[Category:Statically typed programming languages]]
[[Category:Sun Microsystems]]
[[Category:Sun Microsystems]]
[[Category:Compiled programming languages]]

[[Category:American inventions]]
[[ar:جافا]]
<!-- Hidden categories below -->
[[bg:Java]]
[[Category:Articles with example Java code]]
[[bs:Java programski jezik]]
[[ca:Llenguatge Java]]
[[cs:Java]]
[[da:Java (programmeringssprog)]]
[[de:Java (Programmiersprache)]]
[[el:Java]]
[[eo:Java]]
[[es:Lenguaje de programación Java]]
[[et:Java]]
[[fa:زبان برنامه‌نویسی جاوا]]
[[fi:Java]]
[[fr:Java (langage)]]
[[gl:Linguaxe Java]]
[[he:Java]]
[[hr:Java (programski jezik)]]
[[hu:Java programozási nyelv]]
[[id:Java]]
[[is:Java (forritunarmál)]]
[[it:Java (linguaggio)]]
[[ja:Java言語]]
[[ka:Java პროგრამული ენა]]
[[ko:자바 프로그래밍 언어]]
[[lt:Java (kalba)]]
[[lv:Java (valoda)]]
[[mk:Јава (програмски јазик)]]
[[nl:Java (programmeertaal)]]
[[no:Java (programmeringsspråk)]]
[[pl:Java]]
[[pt:Java (linguagem de programação)]]
[[ru:Java]]
[[sk:Java]]
[[sl:Programski jezik Java]]
[[sr:Java]]
[[sv:Java (programspråk)]]
[[ta:ஜாவா நிரலாக்க மொழி]]
[[th:ภาษาจาวา]]
[[tr:Java programlama dili]]
[[uk:Мова програмування Java]]
[[vi:Java (ngôn ngữ lập trình)]]
[[zh:Java]]

Latest revision as of 11:02, 21 May 2025

Java
ParadigmMulti-paradigm: generic, object-oriented (class-based), functional, imperative, reflective, concurrent
Designed byJames Gosling
DeveloperOracle Corporation
First appearedMay 23, 1995; 30 years ago (1995-05-23)[1]
Stable release
Java SE 24[2][3] Edit this on Wikidata / 18 March 2025; 2 months ago (18 March 2025)
Typing disciplineStatic, strong, safe, nominative, manifest
Memory managementAutomatic garbage collection
Filename extensions.java, .class, .jar, .jmod, .war
Website
Influenced by
CLU,[4] Simula67,[4] Lisp,[4] Smalltalk,[4] Ada 83, C++,[5] C#,[6] Eiffel,[7] Mesa,[8] Modula-3,[9] Oberon,[10] Objective-C,[11] UCSD Pascal,[12][13] Object Pascal[14]
Influenced
Ada 2005, ArkTS, BeanShell, C#, Chapel,[15] Clojure, ECMAScript, Fantom, Gambas,[16] Groovy, Hack,[17] Haxe, J#, JavaScript, JS++, Kotlin, PHP, Python, Scala, Seed7, Vala

Java is a high-level, general-purpose, memory-safe, object-oriented programming language. It is intended to let programmers write once, run anywhere (WORA),[18] meaning that compiled Java code can run on all platforms that support Java without the need to recompile.[19] Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of the underlying computer architecture. The syntax of Java is similar to C and C++, but has fewer low-level facilities than either of them. The Java runtime provides dynamic capabilities (such as reflection and runtime code modification) that are typically not available in traditional compiled languages.

Java gained popularity shortly after its release, and has been a popular programming language since then.[20] Java was the third most popular programming language in 2022 according to GitHub.[21] Although still widely popular, there has been a gradual decline in use of Java in recent years with other languages using JVM gaining popularity.[22]

Java was designed by James Gosling at Sun Microsystems. It was released in May 1995 as a core component of Sun's Java platform. The original and reference implementation Java compilers, virtual machines, and class libraries were released by Sun under proprietary licenses. As of May 2007, in compliance with the specifications of the Java Community Process, Sun had relicensed most of its Java technologies under the GPL-2.0-only license. Oracle, which bought Sun in 2010, offers its own HotSpot Java Virtual Machine. However, the official reference implementation is the OpenJDK JVM, which is open-source software used by most developers and is the default JVM for almost all Linux distributions.

Java 24 is the version current as of March 2025. Java 8, 11, 17, and 21 are long-term support versions still under maintenance.

History

Duke, the Java mascot
James Gosling, the creator of Java, in 2008

James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project in June 1991.[23] Java was originally designed for interactive television, but it was too advanced for the digital cable television industry at the time.[24] The language was initially called Oak after an oak tree that stood outside Gosling's office. Later the project went by the name Green and was finally renamed Java, from Java coffee, a type of coffee from Indonesia.[25] Gosling designed Java with a C/C++-style syntax that system and application programmers would find familiar.[26]

Sun Microsystems released the first public implementation as Java 1.0 in 1996.[27] It promised write once, run anywhere (WORA) functionality, providing no-cost run-times on popular platforms. Fairly secure and featuring configurable security, it allowed network- and file-access restrictions. Major web browsers soon incorporated the ability to run Java applets within web pages, and Java quickly became popular. The Java 1.0 compiler was re-written in Java by Arthur van Hoff to comply strictly with the Java 1.0 language specification.[28] With the advent of Java 2 (released initially as J2SE 1.2 in December 1998 – 1999), new versions had multiple configurations built for different types of platforms. J2EE included technologies and APIs for enterprise applications typically run in server environments, while J2ME featured APIs optimized for mobile applications. The desktop version was renamed J2SE. In 2006, for marketing purposes, Sun renamed new J2 versions as Java EE, Java ME, and Java SE, respectively.

In 1997, Sun Microsystems approached the ISO/IEC JTC 1 standards body and later the Ecma International to formalize Java, but it soon withdrew from the process.[29][30][31] Java remains a de facto standard, controlled through the Java Community Process.[32] At one time, Sun made most of its Java implementations available without charge, despite their proprietary software status. Sun generated revenue from Java through the selling of licenses for specialized products such as the Java Enterprise System.

On November 13, 2006, Sun released much of its Java virtual machine (JVM) as free and open-source software (FOSS), under the terms of the GPL-2.0-only license. On May 8, 2007, Sun finished the process, making all of its JVM's core code available under free software/open-source distribution terms, aside from a small portion of code to which Sun did not hold the copyright.[33]

Sun's vice-president Rich Green said that Sun's ideal role with regard to Java was as an evangelist.[34] Following Oracle Corporation's acquisition of Sun Microsystems in 2009–10, Oracle has described itself as the steward of Java technology with a relentless commitment to fostering a community of participation and transparency.[35] This did not prevent Oracle from filing a lawsuit against Google shortly after that for using Java inside the Android SDK (see the Android section).

On April 2, 2010, James Gosling resigned from Oracle.[36]

In January 2016, Oracle announced that Java run-time environments based on JDK 9 will discontinue the browser plugin.[37]

Java software runs on most devices from laptops to data centers, game consoles to scientific supercomputers.[38]

Oracle (and others) highly recommend uninstalling outdated and unsupported versions of Java, due to unresolved security issues in older versions.[39]

Principles

There were five primary goals in creating the Java language:[19]

  1. It must be simple, object-oriented, and familiar.
  2. It must be robust and secure.
  3. It must be architecture-neutral and portable.
  4. It must execute with high performance.
  5. It must be interpreted, threaded, and dynamic.

Versions

As of November 2024, Java 8, 11, 17, and 21 are supported as long-term support (LTS) versions, with Java 25, releasing in September 2025, as the next scheduled LTS version.[40]

Oracle released the last zero-cost public update for the legacy version Java 8 LTS in January 2019 for commercial use, although it will otherwise still support Java 8 with public updates for personal use indefinitely. Other vendors such as Adoptium continue to offer free builds of OpenJDK's long-term support (LTS) versions. These builds may include additional security patches and bug fixes.[41]

Major release versions of Java, along with their release dates:

Version Date
JDK Beta 1995
JDK 1.0 January 23, 1996[42]
JDK 1.1 February 19, 1997
J2SE 1.2 December 8, 1998
J2SE 1.3 May 8, 2000
J2SE 1.4 February 6, 2002
J2SE 5.0 September 30, 2004
Java SE 6 December 11, 2006
Java SE 7 July 28, 2011
Java SE 8 (LTS) March 18, 2014
Java SE 9 September 21, 2017
Java SE 10 March 20, 2018
Java SE 11 (LTS) September 25, 2018[43]
Java SE 12 March 19, 2019
Java SE 13 September 17, 2019
Java SE 14 March 17, 2020
Java SE 15 September 15, 2020[44]
Java SE 16 March 16, 2021
Java SE 17 (LTS) September 14, 2021
Java SE 18 March 22, 2022
Java SE 19 September 20, 2022
Java SE 20 March 21, 2023
Java SE 21 (LTS) September 19, 2023[45]
Java SE 22 March 19, 2024
Java SE 23 September 17, 2024
Java SE 24 18 March 2025[46]

Editions

Sun has defined and supports four editions of Java targeting different application environments and segmented many of its APIs so that they belong to one of the platforms. The platforms are:

The classes in the Java APIs are organized into separate groups called packages. Each package contains a set of related interfaces, classes, subpackages and exceptions.

Sun also provided an edition called Personal Java that has been superseded by later, standards-based Java ME configuration-profile pairings.

Execution system

Java JVM and bytecode

One design goal of Java is portability, which means that programs written for the Java platform must run similarly on any combination of hardware and operating system with adequate run time support. This is achieved by compiling the Java language code to an intermediate representation called Java bytecode, instead of directly to architecture-specific machine code. Java bytecode instructions are analogous to machine code, but they are intended to be executed by a virtual machine (VM) written specifically for the host hardware. End-users commonly use a Java Runtime Environment (JRE) installed on their device for standalone Java applications or a web browser for Java applets.

Standard libraries provide a generic way to access host-specific features such as graphics, threading, and networking.

The use of universal bytecode makes porting simple. However, the overhead of interpreting bytecode into machine instructions made interpreted programs almost always run more slowly than native executables. Just-in-time (JIT) compilers that compile byte-codes to machine code during runtime were introduced from an early stage. Java's Hotspot compiler is actually two compilers in one; and with GraalVM (included in e.g. Java 11, but removed as of Java 16) allowing tiered compilation.[51] Java itself is platform-independent and is adapted to the particular platform it is to run on by a Java virtual machine (JVM), which translates the Java bytecode into the platform's machine language.[52]

Performance

Programs written in Java have a reputation for being slower and requiring more memory than those written in C++.[53][54] However, Java programs' execution speed improved significantly with the introduction of just-in-time compilation in 1997/1998 for Java 1.1,[55] the addition of language features supporting better code analysis (such as inner classes, the StringBuilder class, optional assertions, etc.), and optimizations in the Java virtual machine, such as HotSpot becoming Sun's default JVM in 2000. With Java 1.5, the performance was improved with the addition of the java.util.concurrent package, including lock-free implementations of the ConcurrentMaps and other multi-core collections, and it was improved further with Java 1.6.

Non-JVM

Some platforms offer direct hardware support for Java; there are micro controllers that can run Java bytecode in hardware instead of a software Java virtual machine,[56] and some ARM-based processors could have hardware support for executing Java bytecode through their Jazelle option, though support has mostly been dropped in current implementations of ARM.

Automatic memory management

Java uses an automatic garbage collector to manage memory in the object lifecycle. The programmer determines when objects are created, and the Java runtime is responsible for recovering the memory once objects are no longer in use. Once no references to an object remain, the unreachable memory becomes eligible to be freed automatically by the garbage collector. Something similar to a memory leak may still occur if a programmer's code holds a reference to an object that is no longer needed, typically when objects that are no longer needed are stored in containers that are still in use.[57] If methods for a non-existent object are called, a null pointer exception is thrown.[58][59]

One of the ideas behind Java's automatic memory management model is that programmers can be spared the burden of having to perform manual memory management. In some languages, memory for the creation of objects is implicitly allocated on the stack or explicitly allocated and deallocated from the heap. In the latter case, the responsibility of managing memory resides with the programmer. If the program does not deallocate an object, a memory leak occurs.[57] If the program attempts to access or deallocate memory that has already been deallocated, the result is undefined and difficult to predict, and the program is likely to become unstable or crash. This can be partially remedied by the use of smart pointers, but these add overhead and complexity. Garbage collection does not prevent logical memory leaks, i.e. those where the memory is still referenced but never used.[57]

Garbage collection may happen at any time. Ideally, it will occur when a program is idle. It is guaranteed to be triggered if there is insufficient free memory on the heap to allocate a new object; this can cause a program to stall momentarily. Explicit memory management is not possible in Java.

Java does not support C/C++ style pointer arithmetic, where object addresses can be arithmetically manipulated (e.g. by adding or subtracting an offset). This allows the garbage collector to relocate referenced objects and ensures type safety and security.

As in C++ and some other object-oriented languages, variables of Java's primitive data types are either stored directly in fields (for objects) or on the stack (for methods) rather than on the heap, as is commonly true for non-primitive data types (but see escape analysis). This was a conscious decision by Java's designers for performance reasons.

Java contains multiple types of garbage collectors. Since Java 9, HotSpot uses the Garbage First Garbage Collector (G1GC) as the default.[60] However, there are also several other garbage collectors that can be used to manage the heap, such as the Z Garbage Collector (ZGC) introduced in Java 11, and Shenandoah GC, introduced in Java 12 but unavailable in Oracle-produced OpenJDK builds. Shenandoah is instead available in third-party builds of OpenJDK, such as Eclipse Temurin. For most applications in Java, G1GC is sufficient. In prior versions of Java, such as Java 8, the Parallel Garbage Collector was used as the default garbage collector.

Having solved the memory management problem does not relieve the programmer of the burden of handling properly other kinds of resources, like network or database connections, file handles, etc., especially in the presence of exceptions.

Syntax

This dependency graph of the Java Core classes was created with jdeps and Gephi.

The syntax of Java is largely influenced by C++ and C. Unlike C++, which combines the syntax for structured, generic, and object-oriented programming, Java was built almost exclusively as an object-oriented language.[19] All code is written inside classes, and every data item is an object, with the exception of the primitive data types, (i.e. integers, floating-point numbers, boolean values, and characters), which are not objects for performance reasons. Java reuses some popular aspects of C++ (such as the printf method).

Unlike C++, Java does not support operator overloading[61] or multiple inheritance for classes, though multiple inheritance is supported for interfaces.[62]

Java uses comments similar to those of C++. There are three different styles of comments: a single line style marked with two slashes (//), a multiple line style opened with /* and closed with */, and the Javadoc commenting style opened with /** and closed with */. The Javadoc style of commenting allows the user to run the Javadoc executable to create documentation for the program and can be read by some integrated development environments (IDEs) such as Eclipse to allow developers to access documentation within the IDE.

Hello world

The following is a simple example of a "Hello, World!" program that writes a message to the standard output:

public class Example {
    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

Special classes

Applet

Java applets were programs embedded in other applications, mainly in web pages displayed in web browsers. The Java applet API was deprecated with the release of Java 9 in 2017.[63][64]

Servlet

Java servlet technology provides Web developers with a simple, consistent mechanism for extending the functionality of a Web server and for accessing existing business systems. Servlets are server-side Java EE components that generate responses to requests from clients. Most of the time, this means generating HTML pages in response to HTTP requests, although there are a number of other standard servlet classes available, for example for WebSocket communication.

The Java servlet API has to some extent been superseded (but still used under the hood) by two standard Java technologies for web services:

Typical implementations of these APIs on Application Servers or Servlet Containers use a standard servlet for handling all interactions with the HTTP requests and responses that delegate to the web service methods for the actual business logic.

JavaServer Pages

JavaServer Pages (JSP) are server-side Java EE components that generate responses, typically HTML pages, to HTTP requests from clients. JSPs embed Java code in an HTML page by using the special delimiters <% and %>. A JSP is compiled to a Java servlet, a Java application in its own right, the first time it is accessed. After that, the generated servlet creates the response.[65]

Swing application

Swing is a graphical user interface library for the Java SE platform. It is possible to specify a different look and feel through the pluggable look and feel system of Swing. Clones of Windows, GTK+, and Motif are supplied by Sun. Apple also provides an Aqua look and feel for macOS. Where prior implementations of these looks and feels may have been considered lacking, Swing in Java SE 6 addresses this problem by using more native GUI widget drawing routines of the underlying platforms.[66]

JavaFX application

JavaFX is a software platform for creating and delivering desktop applications, as well as rich web applications that can run across a wide variety of devices. JavaFX is intended to replace Swing as the standard graphical user interface (GUI) library for Java SE, but since JDK 11 JavaFX has not been in the core JDK and instead in a separate module.[67] JavaFX has support for desktop computers and web browsers on Microsoft Windows, Linux, and macOS. JavaFX does not have support for native OS look and feels.[68]

Generics

In 2004, generics were added to the Java language, as part of J2SE 5.0. Prior to the introduction of generics, each variable declaration had to be of a specific type. For container classes, for example, this is a problem because there is no easy way to create a container that accepts only specific types of objects. Either the container operates on all subtypes of a class or interface, usually Object, or a different container class has to be created for each contained class. Generics allow compile-time type checking without having to create many container classes, each containing almost identical code. In addition to enabling more efficient code, certain runtime exceptions are prevented from occurring, by issuing compile-time errors. If Java prevented all runtime type errors (ClassCastExceptions) from occurring, it would be type safe.

In 2016, the type system of Java was proven unsound in that it is possible to use generics to construct classes and methods that allow assignment of an instance of one class to a variable of another unrelated class. Such code is accepted by the compiler, but fails at run time with a class cast exception.[69]

Criticism

Criticisms directed at Java include the implementation of generics,[70] speed,[53] the handling of unsigned numbers,[71] the implementation of floating-point arithmetic,[72] and a history of security vulnerabilities in the primary Java VM implementation HotSpot.[73] Developers have criticized the complexity and verbosity of the Java Persistence API (JPA), a standard part of Java EE. This has led to increased adoption of higher-level abstractions like Spring Data JPA, which aims to simplify database operations and reduce boilerplate code. The growing popularity of such frameworks suggests limitations in the standard JPA implementation's ease-of-use for modern Java development.[74]

Class libraries

The Java Class Library is the standard library, developed to support application development in Java. It is controlled by Oracle in cooperation with others through the Java Community Process program.[75] Companies or individuals participating in this process can influence the design and development of the APIs. This process has been a subject of controversy during the 2010s.[76] The class library contains features such as:

Documentation

Javadoc is a comprehensive documentation system, created by Sun Microsystems. It provides developers with an organized system for documenting their code. Javadoc comments have an extra asterisk at the beginning, i.e. the delimiters are /** and */, whereas the normal multi-line comments in Java are delimited by /* and */, and single-line comments start with //.[84]

Implementations

Oracle Corporation owns the official implementation of the Java SE platform, due to its acquisition of Sun Microsystems on January 27, 2010. This implementation is based on the original implementation of Java by Sun. The Oracle implementation is available for Windows, macOS, Linux, and Solaris. Because Java lacks any formal standardization recognized by Ecma International, ISO/IEC, ANSI, or other third-party standards organizations, the Oracle implementation is the de facto standard.

The Oracle implementation is packaged into two different distributions: The Java Runtime Environment (JRE) which contains the parts of the Java SE platform required to run Java programs and is intended for end users, and the Java Development Kit (JDK), which is intended for software developers and includes development tools such as the Java compiler, Javadoc, Jar, and a debugger. Oracle has also released GraalVM, a high performance Java dynamic compiler and interpreter.

OpenJDK is another Java SE implementation that is licensed under the GNU GPL. The implementation started when Sun began releasing the Java source code under the GPL. As of Java SE 7, OpenJDK is the official Java reference implementation.

The goal of Java is to make all implementations of Java compatible. Historically, Sun's trademark license for usage of the Java brand insists that all implementations be compatible. This resulted in a legal dispute with Microsoft after Sun claimed that the Microsoft implementation did not support Java remote method invocation (RMI) or Java Native Interface (JNI) and had added platform-specific features of their own. Sun sued in 1997, and, in 2001, won a settlement of US$20 million, as well as a court order enforcing the terms of the license from Sun.[85] As a result, Microsoft no longer ships Java with Windows.

Platform-independent Java is essential to Java EE, and an even more rigorous validation is required to certify an implementation. This environment enables portable server-side applications.

Use outside the Java platform

The Java programming language requires the presence of a software platform in order for compiled programs to be executed.

Oracle supplies the Java platform for use with Java. The Android SDK is an alternative software platform, used primarily for developing Android applications with its own GUI system.

Android

The Java language is a key pillar in Android, an open source mobile operating system. Although Android, built on the Linux kernel, is written largely in C, the Android SDK uses the Java language as the basis for Android applications but does not use any of its standard GUI, SE, ME or other established Java standards.[86] The bytecode language supported by the Android SDK is incompatible with Java bytecode and runs on its own virtual machine, optimized for low-memory devices such as smartphones and tablet computers. Depending on the Android version, the bytecode is either interpreted by the Dalvik virtual machine or compiled into native code by the Android Runtime.

Android does not provide the full Java SE standard library, although the Android SDK does include an independent implementation of a large subset of it. It supports Java 6 and some Java 7 features, offering an implementation compatible with the standard library (Apache Harmony).

Controversy

The use of Java-related technology in Android led to a legal dispute between Oracle and Google. On May 7, 2012, a San Francisco jury found that if APIs could be copyrighted, then Google had infringed Oracle's copyrights by the use of Java in Android devices.[87] District Judge William Alsup ruled on May 31, 2012, that APIs cannot be copyrighted,[88] but this was reversed by the United States Court of Appeals for the Federal Circuit in May 2014.[89] On May 26, 2016, the district court decided in favor of Google, ruling the copyright infringement of the Java API in Android constitutes fair use.[90] In March 2018, this ruling was overturned by the Appeals Court, which sent down the case of determining the damages to federal court in San Francisco.[91] Google filed a petition for writ of certiorari with the Supreme Court of the United States in January 2019 to challenge the two rulings that were made by the Appeals Court in Oracle's favor.[92] On April 5, 2021, the Court ruled 6–2 in Google's favor, that its use of Java APIs should be considered fair use. However, the court refused to rule on the copyrightability of APIs, choosing instead to determine their ruling by considering Java's API copyrightable "purely for argument's sake."[93]

See also

References

  1. ^ Binstock, Andrew (May 20, 2015). "Java's 20 Years of Innovation". Forbes. Archived from the original on March 14, 2016. Retrieved March 18, 2016.
  2. ^ "Oracle Releases Java 24".
  3. ^ "JDK 24".
  4. ^ a b c d Barbara Liskov with John Guttag (2000). Program Development in Java – Abstraction, Specification, and Object-Oriented Design. USA, Addison Wesley. ISBN 978-0-201-65768-5.
  5. ^ Chaudhary, Harry H. (July 28, 2014). "Cracking The Java Programming Interview :: 2000+ Java Interview Que/Ans". Archived from the original on September 29, 2023. Retrieved May 29, 2016.
  6. ^ Java 5.0 added several new language features (the enhanced for loop, autoboxing, varargs and annotations), after they were introduced in the similar (and competing) C# language. [1] Archived March 19, 2011, at the Wayback Machine [2] Archived January 7, 2006, at the Wayback Machine
  7. ^ Gosling, James; McGilton, Henry (May 1996). "The Java Language Environment". Archived from the original on May 6, 2014. Retrieved May 6, 2014.
  8. ^ Gosling, James; Joy, Bill; Steele, Guy; Bracha, Gilad. "The Java Language Specification, 2nd Edition". Archived from the original on August 5, 2011. Retrieved February 8, 2008.
  9. ^ "The A-Z of Programming Languages: Modula-3". Computerworld. Archived from the original on January 5, 2009. Retrieved June 9, 2010.
  10. ^ Niklaus Wirth stated on a number of public occasions, e.g. in a lecture at the Polytechnic Museum, Moscow in September 2005 (several independent first-hand accounts in Russian exist, e.g. one with an audio recording: Filippova, Elena (September 22, 2005). "Niklaus Wirth's lecture at the Polytechnic Museum in Moscow". Archived from the original on December 1, 2020. Retrieved November 20, 2011.), that the Sun Java design team licensed the Oberon compiler sources a number of years prior to the release of Java and examined it: a (relative) compactness, type safety, garbage collection, no multiple inheritance for classes – all these key overall design features are shared by Java and Oberon.
  11. ^ Patrick Naughton cites Objective-C as a strong influence on the design of the Java programming language, stating that notable direct derivatives include Java interfaces (derived from Objective-C's protocol) and primitive wrapper classes. [3] Archived July 13, 2011, at the Wayback Machine
  12. ^ TechMetrix Research (1999). "History of Java" (PDF). Java Application Servers Report. Archived from the original (PDF) on December 29, 2010. The project went ahead under the name green and the language was based on an old model of UCSD Pascal, which makes it possible to generate interpretive code.
  13. ^ "A Conversation with James Gosling". ACM Queue. Vol. 2, no. 5. Association for Computing Machinery. August 31, 2004. Archived from the original on July 16, 2015. Retrieved June 9, 2010.
  14. ^ The Java Language Team. About Microsoft's 'Delegates' (White Paper). JavaSoft, Sun Microsystems, Inc. Archived from the original on June 27, 2012. In the summer of 1996, Sun was designing the precursor to what is now the event model of the AWT and the JavaBeans component architecture. Borland contributed greatly to this process. We looked very carefully at Delphi Object Pascal and built a working prototype of bound method references in order to understand their interaction with the Java programming language and its APIs.
  15. ^ "Chapel spec (Acknowledgements)" (PDF). Cray Inc. October 1, 2015. Archived (PDF) from the original on February 5, 2016. Retrieved January 14, 2016.
  16. ^ "Gambas Documentation Introduction". Gambas Website. Archived from the original on October 9, 2017. Retrieved October 9, 2017.
  17. ^ "Facebook Q&A: Hack brings static typing to PHP world". InfoWorld. March 26, 2014. Archived from the original on February 13, 2015. Retrieved January 11, 2015.
  18. ^ "Write once, run anywhere?". Computer Weekly. May 2, 2002. Archived from the original on August 13, 2021. Retrieved July 27, 2009.
  19. ^ a b c "1.2 Design Goals of the Java Programming Language". Oracle. January 1, 1999. Archived from the original on January 23, 2013. Retrieved January 14, 2013.
  20. ^ Melanson, Mike (August 9, 2022). "Don't call it a comeback: Why Java is still champ". GitHub. Archived from the original on August 25, 2023. Retrieved October 15, 2023.
  21. ^ "The top programming languages". The State of the Octoverse. GitHub. Archived from the original on August 2, 2023. Retrieved October 15, 2023.
  22. ^ McMillan, Robert (August 1, 2013). "Is Java Losing Its Mojo?". Wired. Archived from the original on February 15, 2017. Retrieved October 15, 2023.
  23. ^ Byous, Jon (c. 1998). "Java technology: The early years". Sun Developer Network. Sun Microsystems. Archived from the original on April 20, 2005. Retrieved April 22, 2005.
  24. ^ Object-oriented programming "The History of Java Technology". Sun Developer Network. c. 1995. Archived from the original on February 10, 2010. Retrieved April 30, 2010.
  25. ^ Murphy, Kieron (October 4, 1996). "So why did they decide to call it Java?". JavaWorld. Archived from the original on July 13, 2020. Retrieved July 13, 2020.
  26. ^ Kabutz, Heinz; Once Upon an Oak Archived April 13, 2007, at the Wayback Machine. Artima. Retrieved April 29, 2007.
  27. ^ "JAVASOFT SHIPS JAVA 1.0". Archived from the original on March 10, 2007. Retrieved May 13, 2018.
  28. ^ Object-oriented Programming with Java: Essentials and Applications. Tata McGraw-Hill Education. p. 34.
  29. ^ "JSG – Java Study Group". open-std.org. Archived from the original on August 25, 2006. Retrieved August 2, 2006.
  30. ^ "Why Java Was – Not – Standardized Twice" (PDF). Archived (PDF) from the original on January 13, 2014. Retrieved June 3, 2018.
  31. ^ "What is ECMA—and why Microsoft cares". ZDNet. Archived from the original on May 6, 2014. Retrieved May 6, 2014.
  32. ^ "Java Community Process website". Jcp.org. May 24, 2010. Archived from the original on August 8, 2006. Retrieved June 9, 2010.
  33. ^ "JAVAONE: Sun – The bulk of Java is open sourced". GrnLight.net. Archived from the original on May 27, 2014. Retrieved May 26, 2014.
  34. ^ "Sun's Evolving Role as Java Evangelist". O'Reilly Media. Archived from the original on September 15, 2010. Retrieved August 2, 2009.
  35. ^ "Oracle and Java". oracle.com. Oracle Corporation. Archived from the original on January 31, 2010. Retrieved August 23, 2010. Oracle has been a leading and substantive supporter of Java since its emergence in 1995 and takes on the new role as steward of Java technology with a relentless commitment to fostering a community of participation and transparency.
  36. ^ Gosling, James (April 9, 2010). "Time to move on..." On a New Road. Archived from the original on November 5, 2010. Retrieved November 16, 2011.
  37. ^ Topic, Dalibor. "Moving to a Plugin-Free Web". Archived from the original on March 16, 2016. Retrieved March 15, 2016.
  38. ^ "Learn About Java Technology". Oracle. Archived from the original on November 24, 2011. Retrieved November 21, 2011.
  39. ^ "Why should I uninstall older versions of Java from my system?". Oracle. Archived from the original on February 12, 2018. Retrieved September 24, 2021.
  40. ^ "Oracle Java SE Support Roadmap". Oracle. September 13, 2021. Archived from the original on September 19, 2021. Retrieved September 18, 2021.
  41. ^ "Temurin™ Support; Adoptium". adoptium.net. Archived from the original on March 29, 2024. Retrieved March 29, 2024.
  42. ^ "JAVASOFT SHIPS JAVA 1.0". sun.com. Archived from the original on March 10, 2007. Retrieved February 5, 2008.
  43. ^ Chander, Sharat. "Introducing Java SE 11". oracle.com. Archived from the original on September 26, 2018. Retrieved September 26, 2018.
  44. ^ Chander, Sharat (September 15, 2020). "The Arrival of Java 15!". Oracle. Archived from the original on September 16, 2020. Retrieved September 15, 2020.
  45. ^ "JDK 21". openjdk.org. Archived from the original on September 20, 2023. Retrieved September 20, 2023.
  46. ^ "JDK 24".
  47. ^ "Java Card Overview". Oracle Technology Network. Oracle. Archived from the original on January 7, 2015. Retrieved December 18, 2014.
  48. ^ "Java Platform, Micro Edition (Java ME)". Oracle Technology Network. Oracle. Archived from the original on January 4, 2015. Retrieved December 18, 2014.
  49. ^ "Java SE". Oracle Technology Network. Oracle. Archived from the original on December 24, 2014. Retrieved December 18, 2014.
  50. ^ "Java Platform, Enterprise Edition (Java EE)". Oracle Technology Network. Oracle. Archived from the original on December 17, 2014. Retrieved December 18, 2014.
  51. ^ "Deep Dive Into the New Java JIT Compiler – Graal | Baeldung". www.baeldung.com. August 6, 2021. Archived from the original on October 28, 2021. Retrieved October 13, 2021.
  52. ^ "Is the JVM (Java Virtual Machine) platform dependent or platform independent? What is the advantage of using the JVM, and having Java be a translated language?". Programmer Interview. Archived from the original on January 19, 2015. Retrieved January 19, 2015.
  53. ^ a b Jelovic, Dejan. "Why Java will always be slower than C++". Archived from the original on February 11, 2008. Retrieved February 15, 2008.
  54. ^ Hundt, Robert. "Loop Recognition in C++/Java/Go/Scala" (PDF). Archived (PDF) from the original on November 16, 2011. Retrieved July 12, 2012.
  55. ^ "Symantec's Just-In-Time Java Compiler To Be Integrated into Sun JDK 1.1". Archived from the original on June 28, 2010. Retrieved August 1, 2009.
  56. ^ Salcic, Zoran; Park, Heejong; Teich, Jürgen; Malik, Avinash; Nadeem, Muhammad (July 22, 2017). "Noc-HMP: A Heterogeneous Multicore Processor for Embedded Systems Designed in SystemJ". ACM Transactions on Design Automation of Electronic Systems. 22 (4): 73. doi:10.1145/3073416. ISSN 1084-4309. S2CID 11150290.
  57. ^ a b c Bloch 2018, p. 26-28, §Item 7: Eliminate obsolete object references.
  58. ^ "NullPointerException". Oracle. Archived from the original on May 6, 2014. Retrieved May 6, 2014.
  59. ^ "Exceptions in Java". Artima.com. Archived from the original on January 21, 2009. Retrieved August 10, 2010.
  60. ^ "Java HotSpot™ Virtual Machine Performance Enhancements". Oracle.com. Archived from the original on May 29, 2017. Retrieved April 26, 2017.
  61. ^ "Operator Overloading (C# vs Java)". C# for Java Developers. Microsoft. Archived from the original on January 7, 2015. Retrieved December 10, 2014.
  62. ^ "Multiple Inheritance of State, Implementation, and Type". The Java Tutorials. Oracle. Archived from the original on November 9, 2014. Retrieved December 10, 2014.
  63. ^ "Deprecated APIs, Features, and Options". Oracle. Archived from the original on June 19, 2019. Retrieved May 31, 2019.
  64. ^ "Applet (Java Platform SE 7)". Docs. Oracle. Archived from the original on August 2, 2020. Retrieved May 1, 2020.
  65. ^ "What Is a JSP Page? - The Java EE 5 Tutorial". docs.oracle.com. Archived from the original on August 2, 2020. Retrieved May 1, 2020.
  66. ^ "Trail: Creating a GUI With JFC/Swing (The Java Tutorials)". docs.oracle.com. Archived from the original on April 29, 2020. Retrieved May 1, 2020.
  67. ^ "Removed from JDK 11, JavaFX 11 arrives as a standalone module". InfoWorld. September 20, 2018. Archived from the original on October 14, 2020. Retrieved October 13, 2020.
  68. ^ "Getting Started with JavaFX: Hello World, JavaFX Style". JavaFX 2 Tutorials and Documentation. Oracle. Archived from the original on August 2, 2020. Retrieved May 1, 2020.
  69. ^ "Java and Scala's Type Systems are Unsound" (PDF). Archived (PDF) from the original on November 28, 2016. Retrieved February 20, 2017.
  70. ^ Arnold, Ken (June 27, 2005). "Generics Considered Harmful". java.net. Archived from the original on October 10, 2007. Retrieved September 10, 2015.
  71. ^ Owens, Sean R. "Java and unsigned int, unsigned short, unsigned byte, unsigned long, etc. (Or rather, the lack thereof)". Archived from the original on February 20, 2009. Retrieved July 4, 2011.
  72. ^ Kahan, William (March 1, 1998). "How Java's Floating-Point Hurts Everyone Everywhere – ACM 1998 Workshop on Java (Stanford)" (PDF). Electrical Engineering & Computer Science, University of California at Berkeley. Archived (PDF) from the original on September 5, 2012. Retrieved June 4, 2011.
  73. ^ "Have you checked the Java?". Archived from the original on September 21, 2012. Retrieved December 23, 2011.
  74. ^ Chidester, Ashlan. Java Persistence API, Jenkins and AWS. ISBN 9798224253951. Retrieved September 16, 2024.
  75. ^ Cadenhead, Rogers (November 20, 2017), Understanding How Java Programs Work, archived from the original on August 13, 2021, retrieved March 26, 2019
  76. ^ Woolf, Nicky (May 26, 2016). "Google wins six-year legal battle with Oracle over Android code copyright". The Guardian. ISSN 0261-3077. Archived from the original on March 26, 2019. Retrieved March 26, 2019.
  77. ^ a b Bloch 2018, pp. 1–4, § 1 Introduction.
  78. ^ "java.nio (Java Platform SE 8)". docs.oracle.com.
  79. ^ "Java Networking". docs.oracle.com.
  80. ^ "HttpClient (Java SE 11 & JDK 11)". docs.oracle.com.
  81. ^ "Collections Framework Overview". Java Documentation. Oracle. Archived from the original on December 31, 2014. Retrieved December 18, 2014.
  82. ^ "Java Security Overview". Java Documentation. Oracle. Archived from the original on January 3, 2015. Retrieved December 18, 2014.
  83. ^ "Trail: Internationalization". The Java Tutorials. Oracle. Archived from the original on December 31, 2014. Retrieved December 18, 2014.
  84. ^ "How to Write Doc Comments for the Javadoc Tool". Oracle Technology Network. Oracle. Archived from the original on December 18, 2014. Retrieved December 18, 2014.
  85. ^ Niccolai, James (January 24, 2001). "Sun, Microsoft settle Java lawsuit". JavaWorld. IDG News Service. Archived from the original on July 14, 2020. Retrieved July 13, 2020.
  86. ^ van Gurp, Jilles (November 13, 2007). "Google Android: Initial Impressions and Criticism". Javalobby. Archived from the original on August 28, 2008. Retrieved March 7, 2009. Frankly, I don't understand why Google intends to ignore the vast amount of existing implementation out there. It seems like a bad case of "not invented here" to me. Ultimately, this will slow adoption. There are already too many Java platforms for the mobile world and this is yet another one
  87. ^ Mullin, Joe (May 7, 2012). "Google guilty of infringement in Oracle trial; future legal headaches loom". Law & Disorder. Ars Technica. Archived from the original on May 8, 2012. Retrieved May 8, 2012.
  88. ^ Mullin, Joe (May 31, 2012). "Google wins crucial API ruling, Oracle's case decimated". Ars Technica. Archived from the original on March 12, 2017. Retrieved June 1, 2012.
  89. ^ Rosenblatt, Seth (May 9, 2014). "Court sides with Oracle over Android in Java patent appeal". CNET. Archived from the original on May 10, 2014. Retrieved May 10, 2014.
  90. ^ Mullin, Joe (May 26, 2016). "Google beats Oracle—Android makes "fair use" of Java APIs". Ars Technica. Archived from the original on January 20, 2017. Retrieved May 26, 2016.
  91. ^ Farivar, Cyrus (March 27, 2018). ""Google's use of the Java API packages was not fair," appeals court rules". Ars Technica. Archived from the original on September 24, 2019. Retrieved August 6, 2019.
  92. ^ Lee, Timothy (April 23, 2019). "Google asks Supreme Court to overrule disastrous ruling on API copyrights". Ars Technica. Archived from the original on April 23, 2019. Retrieved April 23, 2019.
  93. ^ "Google LLC v. Oracle America, Inc 593 U. S. ____ (2021)" (PDF). Archived (PDF) from the original on April 5, 2021. Retrieved April 6, 2021.

Bibliography