Content deleted Content added
Java 23 |
Citation bot (talk | contribs) Added title. Changed bare reference to CS1/2. | Use this bot. Report bugs. | Suggested by Abductive | Category:Articles containing potentially dated statements from March 2025 | #UCB_Category 781/922 |
||
(44 intermediate revisions by 26 users not shown) | |||
Line 1:
{{pp-semi-indef|small=yes}}▼
{{Short description|Object-oriented programming language}}
{{Distinguish|Java (software platform)|JavaScript
{{Redirect|Openframe|the ten-pin bowling term|Open frame}}
{{Use mdy dates|date=August 2017}}
{{Infobox programming language
| name = Java
| logo = Java programming language logo.svg
| logo size = 121px
| logo caption =
| 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]]
| 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>
| discontinued = <!-- Set to yes if software is discontinued, otherwise omit. -->
| ver layout = <!-- simple (default) or stacked -->
| latest release version = {{wikidata|property|preferred|references|edit|
| latest release date = {{
| designer = [[James Gosling]]
| 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
| 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]], [[
Java gained popularity shortly after its release, and has been a
Java was
== History ==
{{See also|Java (software platform)#History}}
[[File:Duke (Java mascot) waving.svg|thumb|upright=0.5|Duke, the Java mascot]]
Line 55 ⟶ 54:
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>
Java software runs on
[[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>
=== Principles ===
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)|
=== Versions ===
{{Main|Java version history}}
{{As of|
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 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>
Line 105 ⟶ 102:
| Java SE 10 || March 20, 2018
|-
| Java SE 11 (LTS) || September 25, 2018<ref>{{cite
|-
| Java SE 12 || March 19, 2019
Line 113 ⟶ 110:
| Java SE 14 || March 17, 2020
|-
| Java SE 15 || September 15, 2020<ref>{{cite
|-
| Java SE 16 || March 16, 2021
Line 130 ⟶ 127:
|-
| 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 ==
{{See also|Free Java implementations#Class library}}
{{Java platforms}}
Line 145 ⟶ 144:
Sun also provided an edition called [[PersonalJava|Personal Java]] that has been superseded by later, standards-based Java ME configuration-profile pairings.
== Execution system ==
=== 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-
Standard libraries provide a generic way to access host-specific features such as graphics, [[thread (computing)|threading]], and [[Computer network|networking]].
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
==== Performance ====
{{Main|Java performance}}
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 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 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 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,<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.
=== Automatic memory management ===
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>
Line 175 ⟶ 174:
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.
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.
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 ==
{{Main|Java syntax}}
[[File:JavaUniverse.png|thumb|upright|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 (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).
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)|
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.
=== Hello world ===
==Special classes==▼
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 ==
{{more citations needed|section|date=May 2019}}
=== Applet ===
{{Main|Java applet}}
Java applets
=== Servlet ===
{{Main|Java 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 [[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.
Line 205 ⟶ 212:
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 ===
{{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 ===
{{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 ===
{{Main|JavaFX}}
[[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 [[
=== Generics ===
{{Main|Generics in Java}}
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]].
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>
== Criticism ==
{{Main|Criticism of Java}}
Criticisms directed at Java include the implementation of generics,<ref>{{cite web
Line 237 ⟶ 244:
|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
Line 248 ⟶ 255:
|first=William
|date=March 1, 1998
|title=How Java's Floating-Point Hurts Everyone Everywhere
|url=http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf
|publisher=Electrical Engineering & Computer Science, University of California at Berkeley
Line 272 ⟶ 279:
}}</ref>
== Class libraries ==
{{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=§ 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=§ 1 Introduction|pp=1-4}}
** [[Generics in Java|Generics]]
** Scripting, Compiler
Line 302 ⟶ 309:
* Licensing and documentation
== Documentation ==
{{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>
== Implementations ==
{{See also|Free Java implementations|List of Java compilers}}
{{More citations needed|section|date=September 2023}}
Line 320 ⟶ 327:
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.
== 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 application]]s with its own GUI system.
=== Android ===
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
Line 337 ⟶ 344:
|archive-date=August 28, 2008
|archive-url=https://web.archive.org/web/20080828111808/http://www.javalobby.org/nl/archive/jlnews_20071113o.html
|url-status=
}}</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 6 and some Java 7 features, offering an implementation compatible with the standard library ([[Apache Harmony]]).
==== Controversy ====
{{See also|Oracle America, Inc. v. Google, Inc.}}
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
Line 369 ⟶ 376:
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>
== See also ==
{{Portal|Computer programming}}
* [[C Sharp (programming language)|C#]]
Line 383 ⟶ 390:
* [[Comparison of programming languages]]
== References ==
{{Reflist}}
== Bibliography ==
{{
* {{
* {{
* {{
* {{
{{
== 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}}
{{wikiversity|Java Platform, Enterprise Edition/Java EE Tutorial}}
* [https://jdk.java.net/ OpenJDK, Oracle]
* [https://adoptium.net/ JDK builds, Adoptium]
{{Java (software platform)}}
Line 424 ⟶ 429:
[[Category:Sun Microsystems]]
[[Category:Compiled programming languages]]
[[Category:American inventions]]
|