# Java (Language)

## Summary


Java is a high-level programming language, having an object-oriented programming approach. It meets high standards of security. It was developed by James Gosling in 1995 at Sun Microsystems. One of the greatest strengths of Java is portability which allows the programmer to compile the code once and run on any platform. 

Java has many real-world applications from Android gaming applications to scientific applications. It's versatility makes it one of the most popular and trusted languages in the world. The syntax of Java is very similar to C++ language. It's designed to let programmers *write once, run anywhere* .

## Discussion

### Why was Java created in the mid-1990s?

Java was developed by James Gosling at Sun Microsystems in 1995 to allow consumer electronic devices to communicate with each other. It is a high-level, portable and object-oriented programming language. It's designed to let programmers *write once, run anywhere* (WORA), meaning that the compiled Java code can run on all platforms that support Java without the need of recompilation. Gosling made the syntax of Java similar to C/C++ language so that the programmers would find it familiar. 


### What exactly is a Java Virtual Machine?

The code written in Java language is converted into a specific code called **Java Bytecode** by a Java compiler. Then the bytecode is interpreted by a software called the Java Virtual Machine (JVM), or Java Runtime Environment (JRE). 

The JVM acts a virtual computer which translates bytecode into machine instructions for the host computer. This helps in achieving one of the design goals of Java, called **portability**. Portability means that the program written for the Java platform must run similarly on any operating systems regardless of the hardware specifications. Users commonly use a Java Runtime Environment (JRE) installed on their device for running Java applications. 


### What are the different editions of Java?

Sun Microsystems defined and supports four editions of Java for different application environments. Java APIs are categorized according to these environments. The different editions are:  

    + **JavaFX**: A platform that provides a lightweight user-interface API. JavaFX applications can use hardware-accelerated graphics and media engines for high-performance clients.
    + **Java Micro Edition (Java ME)**: A computing platform for development and deployment of Java code for embedded and mobile devices such as mobile phones, micro-controllers and sensor nodes.
    + **Java Standard Edition (Java SE)**: A computing platform for development and deployment of Java code for desktop and servers.
    + **Java Enterprise Edition (Java EE)**: An extension of Java SE with additional features such as distributed computing and web services for enterprises.

### What sort of applications use Java in the real world?

Java has a very wide and extensive usage in the real world. Java is used for various purposes including Android apps, financial applications such as online trading systems, embedded systems, and many more. Java is used in to develop mobile applications, web applications, scientific applications, web servers, applications servers, server apps in the financial services industry, big data technologies, embedded systems, enterprise applications, trading applications, desktop GUI and business applications. 

There are many significant applications like NASA WorldWind, Wikipedia Search, Minecraft, NetBeans, Eclipse IDE and IntelliJ IDEA that are all written in Java. 


### What are the main features of the Java language?

The major features of Java are as follows: 

    + Simple and Familiar: The syntax of Java is made similar to C/C++ language, eliminating the complexities of C/C++.
    + Compiled and Interpreted: Generally, a language is either compiled or interpreted but Java integrates the concepts of compiled and interpreted language.
    + Portable: Programs written for Java platforms run similarly on all operating systems regardless of system hardware components.
    + Architecturally Neutral: A Java program is independent of platforms or environments. It can run on any other operating system that has a compliant JVM.
    + Object-Oriented: Java strictly follows the concept of Object-Oriented Programming (OOP).
    + Robust: Java can handle runtime errors. It supports automatic garbage collection and exception handling.
    + Secure: Java has access modifiers to provide various levels of access to data.
    + Distributed: A Java program can access any other program running on any other machine.
    + Multi-Threaded: Multi-threading means executing multiple threads (portions) of a program in parallel.
    + High Performance: Java programs are highly efficient.
    + Dynamic and Extensible: Since Java is a object-oriented programming language, it gives freedom to add new classes and methods in our program.

### As a beginner, how can I get started with Java programming?

The Java can be installed on Windows, Linux or Mac. The official Java SE by Oracle can be installed. 

Next step is to install an Integrated Development Environment (IDE). IntelliJ, Microsoft Visual Studio and Powerbuilder are a few examples of IDEs. The Java programs can be easily written and run on the IDE. For developing mobile apps using Java, Android Studio is the software to be installed.

Oracle provides beginner to advanced Java courses and certification. It provides many free courses. Oracle Java Training and Certification is a good starting point for more information.


### What are some limitations of using Java?

Although Java is one of the most used programming languages, it has some limitations: 

    + Slow Performance: Bytecode interpretation by the JVM makes it slower than native languages such as C/C++.
    + Memory Consumption: Java programs require more memory compared to C/C++ programs.
    + Low-Level Programming: Java doesn't support low-level programming.
    + Unsigned Data types: Unlike C/C++, doesn't have support for unsigned data types. However, Java 8 APIs introduced some support for these.
    + Garbage Collection: Java doesn't give any control over garbage collection.

### What are some alternatives to Java?

Here are some alternatives to Java: 

    + Python: Python is a high-level, object-oriented programming language. It's one of the easiest language to learn.
    + C#: C# has been competing with Java over the years. It's also an alternative to Java, having a similar syntax.
    + C++: The developers of Java considered many points of C++ while building Java. C++ is relatively faster than Java and also gives programmers some robust features.
    + Kotlin: Kotlin is the official language for Android development. It's an easy-to-code language compared to Java.
    + Swift: Swift is a faster programming language than Java. It's also a secure language.
    + Go: Go is a Google-supported language made for building fast, reliable, and efficient software. Paypal, Netflix and Microsoft use it.
    + Rust: Rust is a fast and memory efficient language used by many companies including Firefox, Dropbox and Cloudflare.


## Milestones

Jun  
1991

James Gosling, Mike Sheridan, and Patrick Naughton start working on the Java language project. The project is named **Oak** after an oak tree standing outside Gosling's office. Later the name is changed to green and finally renamed as **Java** after a type of coffee in Indonesia. 

Jan  
1996

Sun Microsystems makes **Java 1.0** public, promising write once, run anywhere (WORA) functionality. 

May  
2007

Sun Microsystems makes all of the JVM's core code available under **free software and open-source** distribution terms. 

Jan  
2010

Oracle acquires Sun Microsystems. This doesn't change Java's open-source licensing and distribution. 

Jul  
2011

Java Development Kit (JDK) 7 is released. It contains networking and security enhancements. Support for **non-Java languages** is provided in this version. 

Mar  
2014

JDK 8 is released. A new language feature called **Lambda Expressions** is released. The new Modena theme is implemented in this release. Now, the *Java* command launches JavaFX applications. The Rhino JavaScript engine is replaced with the Nashorn JavaScript Engine. 

Sep  
2017

JDK 9 is released. The **module**, a new kind of Java programming component, is introduced. It's a named, self-describing collection of code and data. JDK and JRE runtime images are restructured to accommodate modules, and improve performance, security and maintainability. 

Mar  
2018

JDK 10 is released. A new method `orElseThrow()` is added to the `Optional` class. This is the preferred alternative of existing `get()` method. Several new APIs are added that facilitate the creation of unmodifiable collections. 

Sep  
2018

JDK 11 is released. It combines **Unicode 9.0.0 and 10.0.0** versions including 16,018 new characters, 18 new blocks, and 10 new scripts. **Nests** are introduced, an access-control context aligned with the existing notion of nested types in the Java programming language. 

Mar  
2019

JDK 12 is released. It includes support for **Unicode 11.0.0**. It includes 684 new characters, 11 new blocks, and 7 new scripts. 

Sep  
2021

JDK 17 is released. **Sealed Classes** are added to the Java Language. Sealed classes and interfaces restrict which other classes or interfaces may extend or implement them. An extension to switch function is implemented. The file system provider implementation on macOS is been updated in this release to support extended attributes. JavaDoc can now generate a page summarizing the recent changes in an API.