Developers: | Oracle |
Last Release Date: | 2021/09/16 |
Technology: | Application Development Tools |
The main articles are:
- Logical programming
- Evidence-based programming
- Programming methodology
- Programming technology
- Programmer
Java is an object-oriented programming language developed by Sun Microsystems and officially released on May 23, 1995. Sometimes the name is incorrectly pronounced in Russian as "Java," by analogy with the name of the island of Java.
Java is not only the language itself, but also the platform for creating enterprise-level applications based on this language.
The main features of the language
Initially, the new programming language was called Oak (translated from English - "Oak") and was developed James Gosling for everyday, electronic engineers but was subsequently renamed Java and began to be used to write client applications and. server software It is named after the Java coffee brand, beloved by programmers, so the official Java language emblem shows a cup of steaming coffee.
Java programs are translated into bytecode executed by a virtual java machine (JVM) - a program that processes byte code and sends instructions to equipment as an interpreter, but with the difference that byte code, unlike text, is processed much faster.
The advantage of such a method of executing programs is the complete independence of bytecode from the OS and hardware, which allows Java applications to be executed on any device that supports a virtual machine. Another important feature of Java technology is a flexible security system due to the fact that the execution of the program is completely controlled by the virtual machine. Any operations that exceed the program's established permissions (for example, an attempt to unauthorized access to data or connect to another computer) cause an immediate interruption. This allows users to download programs written in Java to their computers (or other devices, for example, mobile phones) from unknown sources, without fear of virus infection, loss of valuable information, etc.
Often, the disadvantages of the concept of a virtual machine include the fact that the execution of bytecode by a virtual machine can reduce the performance of programs and algorithms implemented in Java. This statement was true for the first versions of the Java virtual machine, but recently it has practically lost its relevance. This was facilitated by a number of improvements: the use of technology JIT (Just-In-Time compilation), which allows translating bytecode into machine code during program execution with the ability to save native-code versions of the class in machine code, widespread use in standard libraries, as well as hardware that provides accelerated bytecode processing (for example, technology Jazelle supported by some of the company's processors). ARM
The ideas embedded in the concept and various implementations of JVM inspired many enthusiasts to expand the list of languages that could be used to create programs executed in the JVM environment[1]. This idea echoes the CLI concept behind Microsoft's .NET platform.
Development Control and Java Rights
2019
Oracle: We were left without a smartphone market due to theft of Java technologies for Android
At the end of March 2019 Oracle , she asked USA Google the Supreme Court not to satisfy the appeal against an earlier court decision, according to which she violated Oracle's copyright when using components from Java in. operating system Android
According to Oracle lawyers, the company was effectively left without a growing market smartphones and faced irreparable negative impact on its business due to Google's illegal actions.
Oracle claims that Google has ruined its hopes of entering the smartphone market as a developer with the Java platform, which makes it possible to develop the launch of programs written in Java, including through APIs. The lawsuit indicates that Google copied these APIs without a proper license.
Google's theory is that by investing all these resources in building a program popular with platform and application developers, Oracle should be obliged to give a competitor the ability to copy its code to help fans create their own bestsellers, Oracle said. |
Google has repeatedly stated that allowing companies to copyright APIs would have a negative impact. However, Oracle told the court that software development "has not experienced the devastating effects that Google predicted; the industry feels better than ever. "
Oracle reminds that Java licenses are free for developers, but companies introducing this technology into their platforms have to pay.
Google refused to enter into a licensing agreement with Oracle because it did not want Android apps to run on other platforms. As a result, Oracle did not get the opportunity to compete in the smartphone market, CRN reports.[2]
Google: Oracle victory in dispute over Oracle use in Android will kill software development
At the end of January 2019 Google , she applied to the Supreme Court USA to reconsider the 9-year trial Oracle over the legality of the use of API Java software interfaces . operating system Android Google believes that Oracle's victory will kill the development. ON
Google is asking the highest court in the United States to support the company in two previously overturned court decisions. In one of them, the Internet giant said that APIs are not copyrighted, and in the other, Google "legally" uses Java APIs.
In a blog post, Google General Counsel Kent Walker compares copyrighted APIs to "claiming that hotkeys can only work on one type of computer."
We created Android in accordance with the long-established practice in the computer industry of reusing APIs that provide instruction sets that facilitate the implementation of common functions. It's like hot keys on a computer keyboard when you press Ctrl + P for fast printing, "Walker writes. |
According to him, Android has created a transformative new platform, allowing millions of Java programmers to use their skills to develop new applications. The creators of Java supported the release of Android, saying the move would provide a powerful boost to the Java community, a Google spokesperson added.
The company believes that the final court decision issued at the end of March 2018, in which Google was found guilty of illegally using the Java API in the Android platform, was a disaster for developers.
If the Supreme Court does not overturn these two decisions, this case will put an end to the traditional ability of developers to freely use existing software interfaces to create new generations of computer programs for consumers, Kent Walker said.[3] |
2018: Victory over Google in Java trial
On March 27, 2018, the United States Court of Appeals for the Federal Circuit ruled positive for Oracle in a proceeding in which the company accused Google of illegally using the Java API in the Android platform. Read more here.
2012: Oracle acquires Java developer
Oracle gained control of Java during the purchase of Sun Microsystems.
On January 25, 2012, Oracle submitted a proposal to the JCP that assumes some reduction in the number of members of the executive committee.
"It appears that pending the convergence of Java ME and Java SE, the current split into two separate executive committees makes no sense. Since Java is one platform, it should be under the control of one executive committee, "the text of the recommendation says.
This is Oracle's second offering.
According to the 2011 blog entries of JCP chairman Patrick Curran, the first and already adopted was aimed at increasing the transparency of specification processes.
The third, which is still to be presented, will concern "more comprehensive changes," including possible changes to the Java Specification Participation Agreement, the legal agreement under which the JCP operates.
2010: Java father demands' freedom from Oracle 'for his brainchild
Java creator James Gosling, who left Sun Microsystems after Oracle acquired it, is running a propaganda campaign under the motto "Java Freedom!" Gosling aims to get Oracle CEO Larry Ellison to transform the Java Community Process into an independent organization that is not influenced by individual companies. Ellison himself proposed creating such an independent association back in 2007.
On the eve of the JavaOne and Oracle OpenWorld 2010 conferences, Gosling released a series of propaganda materials in support of his struggle: T-shirts, badges, mugs with the words "Free Java!," "Oracle, fulfill the promise!," As well as with a portrait of Ellison and the caption "It's not 1984 in the yard!." The creator of Java encourages you to come in his T-shirts to the mentioned conferences to demonstrate your indifference to the fate of the platform.
2010: Oracle begins trial with Google on Java topic
In October 2010, the company Oracle clarified the wording of the lawsuit against Google patent infringement and copyright for Java technologies implemented in mobile. operating system Android The first version of the lawsuit, sent to the court in August 2010, contained few technical details, but now the company attaches even excerpts from the source texts of the programs to the lawsuit.
Oracle claims that approximately a third of the packages in the Android software interface (API) are derived from Java packages copyrighted by Oracle. This applies, among other things, to the names of classes and methods, parameters, definitions and general organization of code and documentation. Some of the source code was directly taken from the copyrighted texts of Oracle programs. Java licenses are free in themselves, but Android uses Google's own Dalvik machine instead of a Java virtual machine, for which programs are written in Java, however. Google believes that Oracle's claims against it and the open source developer community are generally unfounded.
2011: Java Community Process Committee Elections
Since November 3, 2011, VMware is no longer a member of the executive committee of the Java Community Process [4], but it includes Twitter, according to the election results.
The Executive Committee for Control over the Development of Future Versions of Language Platform Specifications, Java in particular for desktops and servers, included Azul Systems, the manufacturer of the Zing virtual Java machine, and Ericsson Intel SAP re-elected to the committee. In addition, and IBM SK Nokia Telecom retained seats on the Mobile Technology Committee (), ARM Java ME Limited and Werner Keil won open membership seats.
Despite leaving the executive committee, VMware remains an important investor in the development of Java platforms through the participation of its SpringSource division, which implements a wide range of products for the development and deployment of Java applications.
According to a post on Oracle's official blog, nearly a quarter (about 23%) of eligible members voted in the election.
"This is much more than the 11% who took part in the special election of the executive committee in 2011, but less than expected," the report said.
Oracle has permanent committee membership, but does not have the ability to dominate the JCP, according to community regulatory filings. The document says, in particular, that Oracle and other members of the executive committee perform the functions of technology oversight groups for the work of expert groups. "Executive committees do not directly manage the work of expert groups on a daily basis. The executive committees have the ability to control the work of each group of experts, in clearly marked intervals, as the specifications pass through the JCP, "the document says.
However, Oracle is aggressively defending its stake in Java. As evidenced by the lawsuit against Google for alleged intellectual property violations regarding the use of Java in the Android mobile OS. There are suspicions that in the past Oracle tried to exert a backstage influence on the election of JCP members.
The JCP community lost such a reputable participant as the Apache Software Foundation, which refused membership due to those signs that it described as Oracle's excessive control over Java.
[4] Java Community Process (JCP) is an official community organized in 1998 to participate interested companies in the formation of Java platform specifications.
SE/EE deals with desktop platforms (Java Platform, Standard Edition) and servers (Java Platform, Enterprise Edition)
2012: Google Wins
In May 2012, the California Federal Court did not see violations by Google and did not recognize Oracle's programming interfaces and Java source code strings as intellectual property. Oracle appealed.
2014: Supreme Court hears Oracle-Google dispute
In May 2014, the US Federal Court of Appeals overturned the ruling in favor of Google. Google appealed to the US Supreme Court to appeal this ruling.[5]
In early December 2014, Oracle sent an appeal to the US Supreme Court, in which it asked to uphold the decision of the appeals court. At the same time, the American representative of Themis received a document in which prominent figures in computer science support Google.
"Leaving thousands of lines ofcode copied by Google unprotected would mean stripping all code from copyright protection," Oracle said in a statement.
Google counters this by saying that it had no choice but to use the ready-made Java components to develop the Android OS, since Java was already very common, and programmers needed familiar APIs to write Java software. Such functional code does not fall under the protection of American copyright law, according to Google.
Oracle and Google patent litigation will affect the software market
A number of prominent computer scientists sided with Google. One of the creators Internet , Vinton Cerf, developer operating system Unix Ken Thompson, and several dozen other well-known PC industry veterans sent a letter to the Supreme Court asking them to reconsider the appeals court's decision and recognize that the software interfaces are not subject to copyright.
According to the authors of the appeal, the situation in which programmers, creating their software interfaces for applications, will worry about purchasing an API license, will greatly slow down the development of innovation and create a serious barrier to establishing compatibility of software products.
The ability to freely use third-party APIs contributes to the creation of software that developers of original programming interfaces would never have thought of or could not have created due to the lack of necessary resources, experts say.
The verdict of the Supreme Court may be decisive for the development of the entire software industry. If API solutions are recognized as intellectual property, compatibility and portability of products will suffer, since the legality of creating functional analogues of software platforms by developing their own compatible APIs will be in question.
1998-2007
In 2017, the current owner of Java, Oracle, announced changes to the license terms and the end of support for Java 8.
In 2007, the process of revealing source codes within the framework of the OpenJDK project was launched, initiated by the then owner of Java - Sun Microsystems.
In 1998, the Java standard became open, and Java Community Process appeared, defining the principles of further evolution of this technology.
Java Platform Classification
There are three main families of technologies within Java:
- J2EE or Java EE (starting with v1.5) - Java Enterprise Editon, for creating enterprise-level software;
- J2SE or Java SE (starting with v1.5) - Java Standard Editon, for creating user applications, primarily for desktop systems;
- J2ME, Java ME or Java Micro Edition for use in devices limited in processing power, including mobile phones, PDAs, embedded systems
The most popular are server technologies of the J2EE family.
The latest release is version 1.6, which improved the security system, improved support, XML and added scripting language JavaScript mechanism-based support, Mozilla improved desktop integration, and added some new features in creating graphical interfaces.
Version history
Java 1.0
Java development began in 1990, the first official version - Java 1.0 - was released only in 1995.
Java 2.0
By 1998, an updated specification JDK 1.2 was developed, released under the name Java 2. Actually, there were no language changes in this version. The platform received the following additions:
- A set of tools for creating a Swing visual user interface.
- Collections.
- Supports Policy files and user digital certificates.
- Accessibility Library.
- Java 2D.
- Support for drag-and-drop technology.
- Full support, Unicode including input support in Chinese and Japanese Korean.
- Support for playing audio files in several popular formats.
- Full support for CORBA technology.
- JIT compiler, improved performance.
- JDK enhancements, including Java profiling support
Java 5
The Java 5 specification was released in September 2004. In this version, the developers have made a number of fundamental additions to the language:
- Enum types. Previously absent types in Java are designed by analogy with C++, but at the same time have a number of additional features.
- The enumerated type is a full Java class, that is, it can have a constructor, fields, methods, including hidden and abstract.
- Enumeration can implement interfaces.
- For enumerations, there are built-in methods that allow you to obtain type values by name, character values corresponding to names, conversion between number and value, and check the type that it is enumerated.
- Annotations - the ability to add metadata to the program text that does not affect code execution, but allows you to use it to obtain various information about the code and its execution. At the same time, the toolkit for using annotated code is released. One application of annotations is to simplify the creation of test modules for Java code.
- Generics is a mechanism similar to templates in C++ or C#, which makes it possible to create classes and methods with fields and parameters of an arbitrary type. Using this mechanism, new versions of the collections of the standard Java library are implemented.
- Methods with an indefinite number of parameters.
- Autoboxing/Unboxing - automatic conversion between scalar Java types and corresponding wrapper types (for example, between int - Integer). This simplifies the code by eliminating the need for explicit type conversions in obvious cases.
- Import of static variables is allowed.
- A cycle based on a collection of objects (iterator) was introduced into the language.
Java 7
- In June 2011, Oracle released a release candidate for the Java 7 platform. The official release of this long-awaited new version is due to take place on July 28, 2011. After 5 years of actual stagnation since the release of Java 6, many users and developers of Java applications are waiting for major changes from the new platform, bringing the Java platform closer to modern realities.
The most notable innovation in Java 7, according to the developers themselves, should be a set of new APIs for organizing I/O under the general name JSR 203. For the first time, Java technology has gained real access to real file systems - this allows you to work with symbolic links and access the functions of each specific file system. The new basic mechanism for branching and combining JSR 166y streams has been redesigned at the initiative of renowned competitive multitasking specialist Doug Lea. By providing true parallelism, Java technology is now fully operational in multi-core computing environments. The Java 7 platform also offers JSR 292 technology, which provides support for dynamically typed programming languages in virtual Java machines (JVM).
The Java 7 candidate release includes just 13 changes from the latest working build of the product. More than half of these changes are purely administrative fixes, but the rest are real revelations, fixing such serious errors as virtual machine failures and incorrect JIT translation in the Eclipse environment.
Java 9 postponed until 2017
On December 2, 2015, developers from Oracle announced that they did not fit into the previously published Java 9[6] preparation schedule[6].
According to the statement, it will take them another six months to bring the Jigsaw project to a proper product, developing Java-significant tools for breaking programs and JDK into modules.
As of December 2, 2015, a schedule has been prepared for approval, according to which the release of JDK 9 is postponed from September 22, 2016 to March 23, 2017. The development of the necessary functionality is expected to be completed on May 25, 2016, and not December 10, 2015, as originally planned.
Java 14 Output
In March 2020, Oracle released Java 14 (Oracle JDK 14) and stated that the new version improves the performance of developers working with the Java programming language. The main innovations are as follows.
- JEP 305: Pattern Matching for instanceof. Extends the pattern mapping functionality for the instanceof statement. This improves the developer's productivity by eliminating the need for template code, and allows for more compact and type-safe code.
- JEP 343: Packaging Tool. Provides developers with the ability to package Java applications for distribution in platform-specific formats. This helps to create modern applications in the form of a single delivered library package, which combines the runtime and application code.
- JEP 345: NUMA-Aware Memory Allocation for G1u Improves the overall performance of G1 garbage collector on systems with NUMA (Non-Uniform Memory Access) architecture.
- JEP 349: JFR Event Streaming. Opens JDK Flight Recorder (JFR) data for continuous monitoring. This will make it easier for various tools and applications to access JFR data and drive further innovation.
- JEP 358: Helpful NullPointerExceptions. Improves the usability of NullPointerException exceptions by describing exactly which variable was zero and providing other useful information.
- JEP 359: Records. Provides a compact syntax for declaring classes that contain shallow immutable data. This feature can significantly reduce pattern code in classes of this type, but the biggest advantage is the ability to simulate data as data.
- JEP 370: Foreign-Memory Access API. An API that allows Java programs to securely and efficiently access areas of external memory outside of Java's dynamically distributed heap memory.[7]
Java 15 Output
In September 2020, Oracle announced the release of Java 15. This year, the programming language celebrates its 25th anniversary.
For the first time, Sealed Classes (JEP 360) have been added as a trial feature of Java 15. Also, in order to obtain additional feedback from the community, pattern matching for the instanceof operator (Pattern Matching, JEP 375) and the record (Records, JEP 384) are re-included as familiarization capabilities.
Other key innovations in Java 15 are as follows:
- JEP 339: Edwards-Curve Digital Signature Algorithm (EdDSA). This feature improves security and performance by implementing cryptographic signatures using the EdDSA algorithm (see RFC 8032 for description).
- JEP 371: Hidden Classes. The function helps to increase performance - it improves the interaction of Java with frameworks that generate classes when executed and use them indirectly, through the reflection mechanism.
- JEP 378: Text Blocks. This feature was an evaluation feature in JDK 13 and JDK 14. It helps increase development performance by adding string literals and automatically formatting strings in a predictable way.
- JEP 377: ZGC. This scalable low latency garbage collector was first introduced in JDK 11 for review and has now been released in the final release.
- JEP 384: Records. This familiarization feature, first introduced in JDK 14, helps improve performance by providing a smaller syntax for declaring classes that contain superficial, immutable data.
- JEP 383: Foreign-Memory Access API. This incubator function, first introduced in JDK 14, defines an API by which Java programs can safely and efficiently access areas of external memory outside of Java's dynamically distributed heap memory.[8]
Java 17
On September 16, 2021, the corporation Oracle introduced Java 17, which has a level of performance, stability and is accompanied by many security updates. This release also contains 14 JEPs (JDK Enhancement Proposal), which lead to further improvements in the Java platform and language programming and help improve developer productivity.
Java 17 is a release from the LTS (long-term support) category, which is released as part of the standard six-month Java release cycle and is the result of close cooperation between Oracle engineers and other Java community members based on OpenJDK Community and Java Community Process (JCP). A previous version of JDK 11 LTS was released three years ago, during which time the system was improved with 70 JEPs from community members.
Oracle JDK 17 and future JDK releases are subject to a fully free license, which will be valid until 2022 after the next LTS release. Oracle will also continue to release Oracle OpenJDK under the General Public License (GPL), the same terms that were approved in 2017.
Oracle is partnering with the Java and JCP developer community to work on an LTS release schedule to offer organizations more flexibility in migrating to the latest versions of Java LTS. Thus, Oracle expects to release LTS Java 21 in September 2023, changing the frequency of LTS release from three years to two years.
Users with Oracle LTS and Java SE subscriptions can migrate to Java 17 in the most comfortable mode for them. Oracle will continue to provide these customers with security updates, guarantee performance, and send Java 17 patches through September 2029.
Over the past three years, we have learned how much developers value additional features, and we have also seen that the ecosystem has fully adopted the six-month release mode, "said Georges Saab, vice president of development for Java Platform Group, Oracle. - And one of the challenges for Java developers is the restriction on using only the LTS release. Therefore, the transition to the release of LTS versions every two years will allow developers from conservative organizations to get more flexibility and work with the functions that they want to use. |
Java Platform Applications
The following successful projects have been implemented using Java (J2EE) technologies: Amazon, eBay, Flickr, Google (Gmail), Yandex, LinkedIn.
The following companies mainly focus on Java (J2EE) technologies rather than.NET, although they also deal with the latter: SAP, IBM, Oracle.
Key features
- automatic memory management
- Enhanced exception handling capabilities
- Rich I/O filtering
- a set of standard collections such as, massif,, etc list stack.;
- Simple means of creating network applications (including using) protocol RMI
- The presence of classes that allow HTTP requests and responses to be processed
- Multi-threaded applications built into the language
- Unified access to JDBC and SQLJ-based databases.
- template support (starting with version 1.5)
Namespace
The idea of namespaces is embodied in Java packages.
Sample Program
Program displaying "Hello, World!": <source lang="java"> public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }
Example of using the collection: <source lang="java"> import java.util.*; public class Sample { public static void main(String[] args) { //Creates a collection object. <String><String>List strings = new ArrayList(); strings.add("Hello"); strings.add("world"); strings.add("!"); for (String s : strings) { System.out.print(s); System.out.print(" "); } } }
Key ideas
Primitive types
Java has only 8 scalar types: boolean, byte, char, short, int, long, float, double.
- Primitive wrapper classes
- java.lang.Byte
- java.lang.Short
- java.lang.Integer
- java.lang.Long
- java.lang.Float
- java.lang.Double
- java.lang.Boolean
- java.lang.Character
The lengths and value ranges of primitive types are determined by the standard, not the implementation, and are shown in the table. The char type was made two-byte for the convenience of localization (one of the ideological principles of Java): when the standard was added, Unicode-16 already existed, but not Unicode-32. Since there is no single-byte type left as a result, a new byte type was added. Float and double types can have special values + INFINITY, -INFINITY, and non-number (NaN). For double, they are denoted by Double.POSITIVE_INFINITY,
Double.NEGATIVE_INFINITY,
Double.NaN;
for the float type - the same way, but with the Float prefix instead of Double. The minimum positive values taken by the float and double types are also standardized.
Type | Length (in bytes) | Range or set of values |
---|---|---|
boolean | undefined | true, false |
byte | 1 | −128..127 |
char | 2 | 0.. 216-1, or 0.. 65535 |
short | 2 | − 215.. 215-1, or − 32768.. 32767 |
int | 4 | − 231.. 231-1, or − 2147483648.. 2147483647 |
long | 8 | − 263.. 263-1, or approximately −9.2·1018.. 9.2·1018 |
float | 4 | - (2-2-23) · 2127.. (2-2-23) · 2127, or approximately −3.4·1038.. 3.4·1038, as well as -INFINITY, INFINITY, NaN |
double | 8 | - (2-2-52) · 21023.. (2-2-52) · 21023, or approximately −1.8·10308.. 1.8·10308, as well as -INFINITY, INFINITY, NaN |
Such strict standardization was necessary to make the language platform-independent, which is one of the ideological requirements for Java and one of the reasons for its success. Nevertheless, one small problem with platform independence still remained. Some processors use 10-byte registers for intermediate storage of results or in other ways improve the accuracy of calculations. In order to make Java as compatible as possible between different systems, in early versions any way to improve the accuracy of calculations was prohibited. However, this led to a decrease in performance. It turned out that few people need a deterioration in accuracy for the sake of platform independence, especially if you have to pay for it by slowing down programs. After numerous protests, this ban was lifted, but added the keyword strictfp
, which prohibits improving accuracy.
Transformations in Mathematical Operations
Java has the following rules:
- If one operand is of type double, the other is also converted to type double.
- Otherwise, if one operand is of type float, the other is also converted to type float.
- Otherwise, if one operand is of type long, the other is also converted to type long.
- Otherwise, both operands are converted to the int type.
The latter rule distinguishes Java from older implementations C and C++ and makes the code more secure. So, for example, in Java after code execution
<source lang="java">short x = 50, y = 1000;</source><target lang="java" xml:lang="en">short x = 50, y = 1000;
int z = x*y;
the variable z
is set to 50000, not − 15536, as in most hopelessly outdated implementations of C and C++. In the program compiled by MS VC++, starting with version 7, as well as many other modern compilers (gcc, Intel C++, Borland C++, Comeau, etc.), the value will also be 50,000.
Object variables, objects, references, and pointers
Java has only dynamically generated objects. Moreover, object-type variables and objects in Java are completely different entities. Object-type variables are references, that is, implicit pointers to dynamically generated objects. This is emphasized by the syntax of the description of variables. So, in Java you cannot write: <source lang="java"> double a[10][20]; Foo b(30); </source> and you need: <source lang="java"> double[][] a = new double[10][20]; Foo b = new Foo(30); </source>
When assigning, passing subprogrammes in, and comparing, object variables behave like pointers, that is addresses , objects are assigned, copied, and compared. And when accessing data fields or object methods using an object variable, no special operations are required - rearrangement this access is carried out as if the object variable were the object itself.
Variables of any type other than simple numeric types are object variables. There are no explicit pointers in Java. Unlike C, C++ pointers and other programming languages, Java links are highly secure due to strict restrictions on their use, in particular:
- You cannot convert an object of type
int
or any other primitive type to a pointer or reference, and vice versa. - You cannot perform++, −−, +, −, or any other arithmetic operation on references.
- Conversion of types between links is strictly regulated. With the exception of array references, it is allowed to convert links only between the inherited type and its heir, and the conversion of the inherited type to the inherited type must be explicitly specified and its meaningfulness is checked at runtime. Array reference transformations are allowed only when transformations of their base types are allowed, and there are no dimensional conflicts.
- In Java, there are no operations to take an address (&) or to take an object to an address (*). An asterisk in Java means multiplication, and only. Ampersand (&) means only "bitwise and" (double ampersand - "logical and").
Due to such specially introduced restrictions in Java, it is impossible to directly manipulate memory at the level of physical addresses (although there are links that do not indicate anything: the value of such a link is indicated by null
).
Duplicate References and Cloning
Because object variables are reference variables, no object is copied during assignment. So, if you write <source lang="java"> Foo foo, bar;
bar = foo;
</source>
then the address will be copied from the foo
variable to the bar
variable. That is, foo
and bar
will point to the same memory area, that is, to the same object; attempting to change the fields of the object referenced by the foo variable will change the
object to which the bar
variable is associated, and vice versa. If you need to get just one more copy of the original object, they use either the (member function, in C++ terminology) clone ()
method, which creates a copy of the object, or a copying constructor.
The clone ()
method requires the class to implement the Cloneable interface (see below for interfaces). If the class implements the Cloneable interface, by default
clone
() copies all fields (small copy). If you do not want to copy, but clone fields (as well as their fields, and so on), you need to override the
clone () method
. Defining and using the clone
() method
is often a non-trivial [1]getClass () task.
Garbage collection
Java cannot explicitly remove an object from memory - garbage collection is implemented instead. A traditional technique that gives the garbage collector a "hint" of freeing memory is to set the variable to null. This, however, does not mean that an object replaced by
null
will certainly and immediately be deleted. This technique only eliminates the reference to the object, that is, unlinks the pointer from the object in memory. Note that the object will not be deleted by the garbage collector as long as it is referenced by at least one of the variables or objects used. There are also methods for initiating forced garbage collection, but they are not guaranteed to be caused by the runtime and are not recommended for normal operation.
Classes and Functions
Java is not a procedural language: any function can only exist within a class. This emphasizes the terminology of the Java language, where there are no concepts of "function" or "member function," but only a method. Standard functions have also become methods. For example, Java does not have the sin ()
function, but the Math.sin
() method of the Math class
(containing, except sin
(), cos
(), exp
(), sqrt
(),
abs (), and many others).
Static Methods and Fields
In order not to create an object of the Math class (and other similar classes) every time you need to call sin ()
(and other similar functions), the concept of static methods (sometimes in Russian they are called static) is introduced. A static method (marked with the
static keyword in the description) can be called without creating an object of its class. Therefore, you can write
<source lang="java">double x = Math.sin(1);</source><source lang="java">double x = Math.sin(1);</source>
instead of
<source lang="java">Math m = new Math();</source><target lang="java" xml:lang="en">Math m = new Math();
double x = m.sin(1);
The limitation imposed on static methods is that in the this
object they can only access static fields and methods.
Static fields have the same meaning as in C++: each exists only in a single instance.
Finality
The final keyword means different things when describing a variable, method, or class. The final variable is initialized in the description and cannot be changed further. The final method cannot be overridden in inheritance. The final class cannot have heirs at all.
Abstractness
In Java, methods that are not explicitly declared final or
private
are virtual in C++ terminology: when calling a method that is differently defined in the base and inheriting classes, a runtime check is always performed.
An abstract method (abstract descriptor) in Java is a method for which parameters and return type are specified, but not a body. The abstract method is defined in the successor classes. In C++, the same is called a purely virtual function. In order to describe abstract methods in a class, the class itself must also be described as abstract. You cannot create objects of an abstract class because you do not know the size of the memory that you want to allocate the gender of an object of this class.
Interfaces
The highest degree of abstractness in Java is the interface. All interface methods are abstract:
an abstract
descriptor is not even required. The interface is not a class. A class can inherit or extend another class or implement
an
interface. In addition, the interface can inherit or extend another interface.
In Java, a class cannot inherit more than one class, but it can implement as many interfaces as you like.
Interfaces can be passed to methods as parameters, but you cannot create objects of their types.
Marker interfaces
Java has some interfaces that do not contain methods for implementation, but are specially processed by JVM. These are the interfaces:
java.lang.Cloneable
java.io.Serializable
java.rmi.Remote
Templates in Java (generics)
Starting with Java 5, a generalized programming mechanism has appeared in the language - templates that are outwardly close to C++ templates. Using a special syntax in the description of classes and methods, you can specify type parameters that can be used within the description as types of fields, parameters, and return values of methods.
<source lang="java"> //Declaration of generalized class class GenericClass<E> { E getFirst() {... } void add(E obj) {... } }
//Using a generalized class in the code <String><String>GenericClass var = new GenericClass(); var.add("qwerty"); String p = var.getFirst(); </source>
Generalized declaration of classes, interfaces and methods is allowed. In addition, the syntax supports limited parameter type declarations: specifying a view construct in the declaration<T extends A & B & C...>
requires that type-parameter T implement interfaces A, B, C, and so on, and the construction<T super C> requires
that type-parameter T be type C or one of its ancestors.
Unlike C# templates, Java templates are not supported by the runtime - the compiler simply creates bytecode in which there are no more templates. The implementation of templates in Java is fundamentally different from the implementation of similar mechanisms in C++: the compiler does not generate a separate version of the class or template method for each case of using the template, but simply creates one implementation of bytecode containing the necessary checks and type transformations. This leads to a number of restrictions on the use of templates in Java programs.
Class Membership Check
In Java, you can explicitly check which class the object belongs to. The foo instanceof Foo
expression is true if the foo
object belongs to the Foo
class or its successor, or implements the Foo
interface (or, in general, inherits the class that implements the interface that inherits Foo
).
Further, the getClass ()
function, defined for all objects, outputs an object of type Class
. These objects can be compared. So, for example, foo.getClass () = = bar.getClass
() will be true if the foo
and bar objects
belong to exactly the same class (but this does not mean that they are two identical objects).
In addition, an object of type Class
of any type can be obtained as follows: Integr.class
, Object.class
.
However, direct class comparison is not always the best way to test for class membership. Often, the isAssignableFrom
() function is used instead. This function is defined on an object of type Class
and takes an object of type Class
as a parameter. Thus, calling Foo.class.isAssignableFrom (Bar.class
) will return true
if Foo
is the ancestor of the Bar class
. Since all objects are descendants of type Object
, calling Object.class.isAssignableFrom<code> () will always <code>return true
.
The function isInstance ()
(equivalent to instanceof) as
well as cast
() (converts the parameter to the object of the selected class) are also used in tandem with the mentioned functions of the object of type Class.
Licensing
2023: New Java Licensing Terms Force Companies to Pay 5 Times More for Software
At the end of February 2023, the analytical company Gartner released the results of a study saying that the new licensing conditions Java would lead to a fivefold increase in the costs of corporate users.
In January 2023, Oracle replaced Java SE and Java SE Desktop subscriptions with the Java SE Universal scheme. It covers the use of the Java SE platform on personal computers, servers and cloud resources. Prior to the changes, Java SE Desktop started at $2.5 per named user or desktop per month, while Java SE subscription prices per processor ranged from $25 per month. The new licensing rules impose a fee on each employee of the company: at the same time, the cost is from $15 per month per employee.
Gartner provides an example of an organization with 49,500 employees with Java SE Desktop Named User Plus (NUP) licenses and 5,000 Java SE subscription processors. Under the old pricing scheme, the costs of such a company would be $742,500 for NUP licenses and $900,000 for processor licenses. The new universal subscription model will require a payment of $3,118,500, which is 90% more.
The Gartner report explained that the move to the new metric could result in a 2- to 5-fold increase in costs for businesses, as Java SE Universal subscriptions require licenses to be purchased for all employees in the organization - whether they use Java SE or not. Moreover, Oracle also accounts for all temporary employees, contractors and agents. Gartner analysts estimated that by 2026, one in five organizations using the Java platform will be audited by Oracle, resulting in "budgeted fees for non-compliance with licensing requirements."[9]
Class Libraries
- JDK - contains a set of base classes for all software on Java SE and Java EE platforms
- CDK - to create chemical software
- MARF - Modular Library for Audio Recognition
Software Development Tools
- Oracle Java Development Kit - in addition to a set of libraries for Java SE and Java EE platforms, it contains a javac command line compiler and a set of utilities that also work in command line mode.
- NetBeans IDE is a free integrated development environment for all Java platforms - Java ME, Java SE and Java EE. Promoted by Sun Microsystems, a Java developer, as a basic tool for developing software in Java and other languages (C , C++, Ruby, Fortran, etc.).
- Eclipse is a free integrated development environment for Java SE and Java EE. Work is underway to support the Java ME platform in Eclipse. Promoted by IBM, one of the most important enterprise software developers, as a basic tool for developing software in Java and other languages (C , C++, Ruby, Fortran, etc.)
- IntelliJ IDEA is a commercial development environment for Java SE, Java EE and Java ME platforms.
Popularity of Java
2024: Java in the Service of Business: On Adapting Technology to Different Sectors of the Economy
The article considers the role of the Java language in various areas of business: finance, healthcare, telecommunications, retail and e-commerce.
Today, Java plays a special role in business, being one of the leading software development tools. According to the PYPL Programming Languages Popularity Index, created on the basis of an analysis of the frequency of searching for tutorials on them in Google, Java ranks second. Its popularity is built not only on capacity and flexibility, but also on the ability to adapt to various areas of the economy: from healthcare and the financial sector to telecommunications and retail. Read more here.
2018: World No.
In December 2018, Tiobe published a regular rating of programming languages based on the calculation of search results containing the name of the language. Java remains in first place. Read more here.
2013: Java reverted to the status of the most popular programming language
Despite all problems with safety found recently Java returned itself the first place in monthly popularity rating of the Tiobe Programming Community Index programming languages. Before that, as many as desyat mesyatsev pervoye place of zanimal Xi. The company Tiobe considers that the popularity of Java grew thanks to success of Android backgrounds.
So, Java teper reyting populyarnosti 18.387%, while C has 17.080. The desyatku also includes Objective-C (9.803), C++ (8.758), C# (6.680), PHP (5.074), Python (4.949), Visual Basic (4.648), Perl (2.252) and Ruby (1,752). Python Populyarnost among interpretatorov rastet, and vskore it can oboyti PHP polagayut in Tiobe.
Estimate popularity of languages at Tiobe by the number of programmers, courses and suppliers of tools. The first place of Java confirms one more rating, PyPL Popularity of Language according to which result of language of 29%. At PyPL other technique of calculation - by quantity of the search queries concerning the guides to programming languages. Soglasno PyPL, PHP vtorom in seychas place (14.6), followed by sleduyut C# (10.5), Python (10.3), C++ (9.8), C (9.6), JavaScript (7.5), Visual Basic (3.8), Ruby (2.9) and Perl (1.9).
Java и Microsoft
The company Microsoft developed its own implementation of JVM (MSJVM), which was included in various, OS starting with. Windows 95 MSJVM was close to the v.1.1.3 specification Sun Microsystems , but did not meet it in a number of fundamental characteristics (in particular, due to the lack of technology support RMI JNI and the presence of non-standard extensions). Subsequently, this was the reason for lawsuits from the side. The court Sun Microsystems Microsoft sided with Sun Microsystems. Ultimately, an agreement was reached between the two companies on the possibility of extending the period of official support for users of the non-standard Microsoft JVM until the end of 2007, but no more[10]company[11] Microsoft .NET offers a Java-like language for the platform that does not J# meet the official Java language specification.
Java's 20th Anniversary
May 23, 2015 marks the 20th anniversary of the release of the first version of Java.
At Oracle, the twenty-year anniversary since Java was celebrated with a noisy marketing event[12].
When Java was introduced by Sun Microsystems, bought by Oracle in 2010, it was even more of a "pre-Internet" era, and the global IT landscape was very different from the current one. Nevertheless, Java still remains in the developer's "toolbox," and many other languages widely used in the 1990s, such as Delphi or Perl, remain out of work or are used only for a limited range of tasks.
According to the developers of the Java Oracle platform, the main value of Java is readability and simplicity.
As of May 23, 2015, at least one language in terms of the breadth of use in the computer industry is unlikely to compare with Java. According to Oracle estimates, more than 9 million developers use Java and it is used in 7 billion devices. Java works as a "motor," both in very small devices and in large cloud computing systems.
Google made Java the main language for writing programs for. Android At the other end of the spectrum is a platform framework Map/Reduce that Hadoop relies on Java to process petabytes of data. Programmers love Java, including because the language is easy to read compared to impassable "wilds" sometimes found in C++ or Perl code.
Readability is a very valuable feature for the programming language, especially used to develop enterprise-level software, he explained. When it comes to a complex system, a programmer needs the ability to understand code that was written months or years ago.
There were other characteristics in favor of Java. One of them is the execution of the slogan "written once, works everywhere" advertised at one time. Since the code is executed on a Java cross-platform virtual machine, you can write a program on a laptop with, and Windows it can work on a server Linux with or Solaris without recompilation.
IDC believes that due to the long-term preservation of backward compatibility, as well as the "methodical development" of the language, its popularity remains high. The use of Java in Android and the competent actions of Oracle definitely extended the life of the platform, ensuring the demand for developers with appropriate skills.
Oracle develops the language, maintaining its appeal. In the plans of the corporation, in the release of Java 9, preparing for September 2016, the language will be reorganized and brought to a modular architecture.
See also
- Comparison of C# and Java
- To compare Java capabilities with other languages, see Compare programming languages
Links
- Official Java site supported by Sun
- «Product:Java» в разделе Википедии на русском языке
- ru.sun.com - Java resources and documentation in Russian from SUN
- developers.sun.ru - Russian developer portal in Russian from Sun Microsystems
- Bruce Eckel's Free Electronic Books - free electronic versions of Bruce Eckel's C++ and Java books along with source code
- SOA and Java articles
- http://bruceeckel.by.ru - translations into Russian of some of Bruce Eckel's free Java books
- Canadian Mind Products Java & Internet Glossary - it is clear about the basic aspects of Java technologies
- All about Java technology
- Russian site about Java: library, forums, link catalog , etc.
- Java User Group Site: User Meetings, News
- KPI Java Developer Community: wiki, forum, news, glossary
- Belarusian Java User Group - news, community meetings, reports of leading experts, exchange of experience
- TheServerSide: Enterprise Java Community — ServerSide News, Books, Discussions & Reviews
Literature
Programming languages
Notes
- ↑ Online catalog of alternative languages and language extensions for JVM
- ↑ Oracle claims Google barred it from smartphone market
- ↑ Google: Oracle Java win will kill software development, so Supreme Court must rule
- ↑ 4,0 4,1 SE/EE1
- ↑ Oracle's lawsuit against Google continues and could have a huge effect on the tech industry
- ↑ 6,0 6,1 [http://www.opennet.ru/opennews/art.shtml?num=43437 Java 9
- ↑ Programming language Java 14 is out with these 16 major feature improvements
- ↑ JDK 15: The new features in Java 15
- ↑ Oracle's revised Java licensing terms 2-5x more expensive for most orgs
- ↑ Microsoft's official statement about the MSJVM support program. The
- ↑ currently
- ↑ , the 20-year timeline