Skip to content
Home

Java (programming language): overview, design, history, and ecosystem

Java is a widely used, class-based, object-oriented programming language and runtime ecosystem known for portability, rich standard libraries, and a large ecosystem across servers, desktops and mobile devices.

Java is a high-level, class-based, object-oriented programming language and a runtime platform designed with portability and safety in mind. First introduced by Sun Microsystems, it emphasizes the write-once, run-anywhere principle: source code is compiled to an intermediate bytecode that executes on a Java Virtual Machine (JVM) rather than being compiled directly to a platform-specific machine language. This abstraction enables the same Java programs to run on many operating systems and processor architectures with a compatible JVM.

Image gallery

2 Images

Key characteristics

Java's design goals include simplicity, strong typing, automatic memory management, and a rich standard library. Important characteristics are:

  • Object orientation: Java models data and behavior as objects and classes, providing encapsulation, inheritance and polymorphism.
  • Portability: Java compiles to bytecode, not native machine code, and the JVM interprets or just-in-time compiles that bytecode on each platform.
  • Automatic memory management: A garbage collector reclaims unused memory, reducing a class of errors common in manual memory management languages.
  • Robust standard library: Extensive APIs for collections, I/O, networking, concurrency, security and graphical user interfaces.

History and development

Development began in the early 1990s under the name Oak; the language was later renamed Java and publicly released by Sun Microsystems. Sun was subsequently acquired by Oracle Corporation, which maintains the official reference implementation and stewarding of the Java platform. Over time Java has evolved through both short-term feature releases and designated long-term support (LTS) releases that organizations rely on for stability.

Versions, distribution and implementations

Oracle provides one distribution of the Java Development Kit (JDK) and JVM, but a number of open-source and commercial builds coexist. Community projects and vendors produce alternative distributions and long-term support schedules. Tooling around Java includes compilers that emit bytecode, build systems and package managers, and multiple implementations of the JVM optimized for different workloads.

Common uses and ecosystem

Java is widely used in server-side applications, enterprise systems, desktop software, large-scale data processing, embedded devices and Android app development. The language's maturity has produced a broad ecosystem of frameworks, libraries and application servers that support web services, microservices, distributed systems and high-performance backend systems.

Relationships and comparisons

Java's syntax and some idioms will be familiar to programmers experienced in languages such as C, C++ and C#, but Java's runtime model and memory management differ in important ways. It is strictly typed and uses automatic garbage collection, which contrasts with manual memory management in C and C++. Java emphasizes backward compatibility so that older programs often run on newer JVMs with little or no change.

Further reading and resources

For official documentation, tutorials and downloads consult an authoritative source such as Java documentation or the original vendor pages like Sun Microsystems and Oracle. To read about object-oriented principles and design, see materials linked from object-oriented programming and explanations of objects in programming. Comparisons and language relatives include discussions of C, C++ and C#. Information about platform support and operating systems can be found via OS compatibility references; Java's role in mobile development and Android is discussed on pages such as Android and mobile platform analyses like mobile OS market. Technical details about compiling Java to bytecode and the distinction from native machine code are documented in resources about the Java compiler and native code generation versus machine code.

Basic Concepts

The design of the Java programming language aimed mainly at five goals:

Simplicity

Java is simple compared to other object-oriented programming languages such as C++ or C# because it has a reduced language scope and does not support operator overloading and multiple inheritance, for example.

Object Orientation

Java belongs to the object-oriented programming languages.

Distributed

A number of simple options for network communication, from TCP/IP protocols to remote method invocation to Web services, are provided primarily through Java's class library; the Java language itself does not include direct support for distributed execution.

Familiarity

Because of the syntactic closeness to C++, the original similarity of the class library to Smalltalk class libraries, and the use of design patterns in the class library, Java shows no unexpected effects for the experienced programmer.

Robustness

Many of the design decisions made in the definition of Java reduce the likelihood of unintended system errors; notable among these are strong typing, garbage collection, exception handling, and abandonment of pointer arithmetic.

Security

This is supported by concepts such as the class loader, which controls the secure delivery of class information to the Java Virtual Machine, and security managers, which ensure that access is only allowed to program objects for which appropriate rights are available.

Architecture neutrality

Java is designed so that the same version of a program will, in principle, run on any computer hardware, regardless of its processor or other hardware components.

Portability

In addition to being architecture neutral, Java is portable. This means that primitive data types are standardized in their size and internal representation as well as in their arithmetic behavior. For example, a float is always an IEEE 754 float of 32 bits in length. The same applies, for example, to the class library, which can be used to create a GUI independent of the operating system.

Performance

Java has the potential to achieve better performance than languages limited to compile-time optimizations (C++, etc.) due to the run-time optimization possibility. This is countered by the overhead caused by the Java runtime environment, so that the performance of, for example, C++ programs is surpassed in some contexts, but not achieved in others.

Interpretability

Java is compiled into machine-independent bytecode, which in turn can be interpreted on the target platform. Oracle's Java Virtual Machine interprets Java bytecode before compiling and optimizing it for performance reasons.

Parallelizability

Java supports multithreading, i.e. the parallel execution of independent program sections. For this purpose, the language itself offers the keywords synchronized and volatile - constructs that support the "Monitor & Condition Variable Paradigm" by C. A. R. Hoare. The class library includes further support for parallel programming with threads. Modern JVMs map a Java thread to operating system threads and thus benefit from processors with multiple cores.

Dynamic

Java is structured in such a way that it can be adapted to dynamically changing conditions. Since the modules are linked only at runtime, parts of the software (such as libraries) can be redelivered, for example, without having to adapt the remaining program parts. Interfaces can be used as a basis for communication between two modules; however, the actual implementation can be changed dynamically and, for example, also during runtime.

Object Orientation

The basic idea of object-oriented programming is to combine data and associated functions as closely as possible in a so-called object and to encapsulate them externally (abstraction). The intention behind this is to make large software projects easier to manage and to increase the quality of the software. Another goal of object orientation is a high degree of reusability of software modules.

A new aspect of Java compared to the object-oriented programming languages C++ and Smalltalk is the explicit distinction between interfaces and classes, which is expressed by corresponding keywords interface and class. Java does not support inheritance of multiple independent base classes (so-called "multiple inheritance" as in C++ or Eiffel), but it does support the implementation of an arbitrary number of interfaces, which also solves many of the corresponding problems. Method signatures and standard implementations of methods are passed on to the derived classes, but not attributes.

Java is not completely object-oriented, since the basic data types (int, boolean, etc.) are not objects (see also under Java syntax). However, as of Java 5, they are converted automatically and transparently for the programmer into the corresponding object types and vice versa by means of autoboxing, if required.

Example

Source code
/** * This class is a general class for any animal and provides * methods common to all animals.  */ public class Animal {    /**     * This method lets the animal communicate. The subclasses of this         * class can override   this method and provide an appropriate    * implementation for the animal in question.          */      public void communicate() { // Used by all subclasses that do not override this method.     System. out. println("Animal says nothing."); } } /** * Declares the class "dog" as a subclass of the class "animal".  * The class "Dog" thus inherits the fields and methods of the class "Animal".  */ public class Dog extends Animal {        /** * This method is implemented in the superclass "Animal". It is        * overridden in this class and customized for the "Dog" animal type.         */      @Override      public void communicate() {                // Calls the implementation of this method in the superclass "animal".           super. communicate();          // Prints a text to the console.               System. out. println("Dog says: 'Woof Woof'");        } } /** * Declares the class "Cat" as a subclass of the class "Animal".  * The class "Cat" thus inherits the fields and methods of the class "Animal".  */ public class Cat extends Animal {       /**     * This method is implemented in the superclass "Animal". It is         * overridden in this class and adapted for the animal type "cat".    */         @Override      public void communicate() {           // Calls the implementation of this method in the superclass "animal".           super. communicate();          // Prints a text to the console.         System. out. println("Cat says: 'Meow'");     } } public class Main {    /**     * Method that is called        when the program starts.          */      public static void main(String[] args) {              // Declares a variable for instances of the classes "dog" and "cat".               Tier tier;             // Creates an instance of the class "dog" and stores the instance in                // the variable "animal               animal = new dog();            // Calls the method dog.communicate()              animal.communicate();                 // Creates an instance of the class "cat" and stores the instance in the variable              // the variable "animal           animal = new cat();            // calls the method cat.communicate()              animal.communicate(); } }
Console output
Animal says nothing. Dog says: 'Woof Woof' Animal says nothing. Cat says, 'Meow

Reflection

Java offers a Reflection API as part of the runtime environment. This makes it possible to access classes and methods at runtime whose existence or exact specification was not known at the time of program creation. This technique is often used in connection with the factory method design pattern.

Annotations

With Java 5, Sun has extended the programming language with annotations. Annotations allow the notation of metadata and enable user-defined language extensions to a certain extent. The purpose of annotations is, among other things, the automatic generation of code and other documents important in software development for recurring patterns based on the shortest possible notes in the source code. Until now, only Javadoc comments with special JavaDoc tags were used for this purpose in Java, which were evaluated by doclets such as the XDoclet.

Annotations can also be contained in the compiled class files. Thus, the source code is not required for their use. In particular, the annotations are also accessible via the Reflection API. For example, they can be used to extend the bean concept.

Modular execution on remote computers

Java provides the ability to write classes that run in different execution environments. For example, applets can be executed in web browsers that support Java. Java's security concept can be used to ensure that unknown classes cannot cause any damage, which is particularly important for applets (see also Sandbox). Examples of Java modules that can be executed in corresponding execution environments are applets, servlets, portlets, MIDlets, xlets, translets, and Enterprise JavaBeans.

Features

Object access in Java is implemented VM-internally via references, which are similar to the pointers known from C or C++. The language definition (Java Language Specification) calls them "Reference Values" to make it clear that they are passed in the source code of the respective program as a call by value. For security reasons, these do not allow the actual memory address to be recognized or modified. So-called pointer arithmetic is thus excluded in Java. By design, a common type of error that occurs in other programming languages can thus be excluded from the outset.

Classes that belong together are grouped together in packages. These packages allow limiting the visibility of classes, structuring larger projects, and separating the namespace for different developers. Package names are hierarchical and usually start with the (reverse) Internet domain name of the developer, for example com.google for class libraries provided by Google. Class names only need to be unique within a package. This makes it possible to combine classes from different developers without naming conflicts. However, the hierarchy of package names has no semantic meaning. When it comes to visibility between the classes of two packages, it does not matter where the packages are in the naming hierarchy. Classes are either only visible to classes in their own package, or to all packages.

Furthermore, the language supports threads (concurrently running program parts) and exceptions. Java also includes an automatic garbage collector that removes objects that are no longer referenced from memory.

Java explicitly distinguishes between interfaces and classes. A class can implement any number of interfaces, but always has exactly one base class. Java does not support direct inheritance from multiple classes ("multiple inheritance"), but it does support inheritance over multiple hierarchy levels (class child inherits from class father, which in turn inherits from class grandfather, etc.). Depending on the visibility (public, protected, default/package-private, private), the class inherits methods and attributes (also called fields) from its class ancestors. All classes are derived - directly or indirectly - from the root class Object.

Java includes an extensive class library. This provides the programmer with a uniform interface (application programming interface, API) that is independent of the underlying operating system.

Java 2 introduced the Java Foundation Classes (JFC), which among other things provide Swing, which is used to create platform-independent graphical user interfaces (GUI) and is based on the Abstract Window Toolkit.

Questions and answers

Q: What is the name of the programming language created by Sun Microsystems?

A: The programming language created by Sun Microsystems is called Java.

Q: Who currently supports and keeps Java up to date?

A: Oracle Corporation currently supports and keeps Java up to date.

Q: What are the current long-term support (LTS) versions of Java?

A: The current long-term support (LTS) versions of Java are version 17, 11, and 8.

Q: When was the latest version of Java released?

A: The latest version of Java, version 19, was released in September 2022.

Q: Is there any other company that supports Java besides Oracle?

A: Yes, Eclipse Adoptium also supports Java for at least May 2026 for version 8 and at least September 2027 for version 17.

Q: What type of code does Java use?

A:Java uses object oriented code which means it is based on objects that work together to make programs do their jobs. It looks similar to C, C++ or C# but code written in those languages will not work in most cases without being changed.

Q: How does Java make itself platform independent?

A:Java makes itself platform independent by making the compiler turn code into a special format called bytecode instead of machine code. This means when the program is executed, the bytecode can be interpreted by a special program called a virtual machine which translates it into machine code so it can run on different operating systems such as Android.

Related articles

Author

AlegsaOnline.com Java (programming language): overview, design, history, and ecosystem

URL: https://en.alegsaonline.com/art/49636

Share

Sources