Java Introduction

Java is a general term for the Java object-oriented programming language and the Java platform launched by Sun Microsystems in May 1995. It was developed by James Gosling and his colleagues and officially released in 1995.

Later, Sun was acquired by Oracle Corporation, and Java subsequently became a product of Oracle.

Java is divided into three systems:

  • JavaSE (J2SE) (Java 2 Platform Standard Edition, Java Platform Standard Edition)
  • JavaEE (J2EE) (Java 2 Platform, Enterprise Edition, Java Platform Enterprise Edition)
  • JavaME (J2ME) (Java 2 Platform Micro Edition, Java Platform Micro Edition).

In June 2005, the JavaOne conference was held, and Sun announced Java SE 6. At that time, the various versions of Java had been renamed to remove the number "2": J2EE was renamed Java EE, J2SE was renamed Java SE, and J2ME was renamed Java ME.


Main Features

  • The Java language is simple:

    The syntax of the Java language is very similar to that of C and C++, making it easy for most programmers to learn and use. On the other hand, Java discards those features of C++ that are rarely used, hard to understand, and confusing, such as operator overloading, multiple inheritance, and automatic forced type conversion. In particular, the Java language does not use pointers but references. It also provides automatic allocation and reclamation of memory space, so programmers do not need to worry about memory management.

  • The Java language is object-oriented:

    The Java language provides object-oriented features such as classes, interfaces, and inheritance. For simplicity, it only supports single inheritance among classes, but it supports multiple inheritance among interfaces, and supports the implementation mechanism between classes and interfaces (the keyword is implements). The Java language fully supports dynamic binding, while C++ only uses dynamic binding for virtual functions. In short, Java is a pure object-oriented programming language.

  • The Java language is distributed:

    The Java language supports the development of Internet applications. In the basic Java application programming interface, there is a network application programming interface (java net), which provides class libraries for network application programming, including URL, URLConnection, Socket, ServerSocket, etc. Java's RMI (Remote Method Invocation) mechanism is also an important means of developing distributed applications.

  • The Java language is robust:

    Java's strong typing mechanism, exception handling, and automatic garbage collection are important guarantees of the robustness of Java programs. The abandonment of pointers is a wise choice for Java. Java's security checking mechanism makes Java even more robust.

  • The Java language is secure:

    Java is often used in network environments. For this reason, Java provides a security mechanism to prevent attacks by malicious code. In addition to the many security features of the Java language, Java has a security prevention mechanism (the ClassLoader class) for classes downloaded over the network, such as assigning different namespaces to prevent substitution of local classes with the same name, bytecode checking, and a security management mechanism (the SecurityManager class) that allows Java applications to set security sentinels.

  • The Java language is architecture-neutral:

    Java programs (files with the .java extension) are compiled on the Java platform into an architecture-neutral bytecode format (files with the .class extension), which can then run on any system that implements the Java platform. This approach is suitable for heterogeneous network environments and software distribution.

  • The Java language is portable:

    This portability comes from architectural neutrality. In addition, Java strictly specifies the length of each basic data type. The Java system itself is also highly portable: the Java compiler is implemented in Java, and the Java runtime environment is implemented in ANSI C.

  • The Java language is interpreted:

    As mentioned earlier, Java programs are compiled into bytecode format on the Java platform, and can then run on any system that implements the Java platform. At runtime, the Java interpreter in the Java platform interprets and executes these bytecodes, and the classes needed during execution are loaded into the runtime environment during the linking phase.

  • Java is high-performance:

    Compared with interpreted high-level scripting languages, Java is indeed high-performance. In fact, with the development of JIT (Just-In-Time) compiler technology, Java's running speed is getting closer and closer to C++.

  • The Java language is multithreaded:

    In the Java language, a thread is a special object that must be created by the Thread class or its subclasses (descendant classes). There are usually two ways to create a thread: one is to use a constructor with the signature Thread(Runnable) to wrap an object that implements the Runnable interface into a thread; the other is to derive a subclass from the Thread class and override the run method; the object created using this subclass is the thread. It is worth noting that the Thread class already implements the Runnable interface, so every thread has its run method, and the run method contains the code that the thread is to execute. The activity of a thread is controlled by a set of methods. The Java language supports the simultaneous execution of multiple threads and provides a synchronization mechanism between multiple threads (the keyword is synchronized).

  • The Java language is dynamic:

    One of the design goals of the Java language is to adapt to dynamically changing environments. The classes required by a Java program can be dynamically loaded into the runtime environment, and the needed classes can also be loaded over the network. This also facilitates software upgrades. In addition, classes in Java have a runtime representation, enabling runtime type checking.


Development History

  • On May 23, 1995, the Java language was born.
  • In January 1996, the first JDK - JDK 1.0 - was born.
  • In April 1996, 10 of the leading operating system vendors announced that they would embed Java technology in their products.
  • In September 1996, approximately 83,000 web pages were created using Java technology.
  • On February 18, 1997, JDK 1.1 was released.
  • On April 2, 1997, the JavaOne conference was held, with more than 10,000 participants, setting a record at the time for the scale of similar conferences worldwide.
  • In September 1997, the Java Developer Connection community had more than 100,000 members.
  • In February 1998, JDK 1.1 was downloaded more than 2,000,000 times.
  • On December 8, 1998, the Java 2 enterprise platform J2EE was released.
  • In June 1999, Sun released three versions of Java: Standard Edition (Java SE, formerly J2SE), Enterprise Edition (Java EE, formerly J2EE), and Micro Edition (Java ME, formerly J2ME).
  • On May 8, 2000, JDK 1.3 was released.
  • On May 29, 2000, JDK 1.4 was released.
  • On June 5, 2001, Nokia announced that it would sell 100 million Java-enabled mobile phones by 2003.
  • On September 24, 2001, J2EE 1.3 was released.
  • On February 26, 2002, J2SE 1.4 was released, and since then Java's computing capabilities have been greatly improved.
  • At 6:00 PM on September 30, 2004, J2SE 1.5 was released, becoming another milestone in the history of the Java language. To indicate the importance of this version, J2SE 1.5 was renamed Java SE 5.0.
  • In June 2005, the JavaOne conference was held, and Sun announced Java SE 6. At that time, the various versions of Java had been renamed to remove the number "2": J2EE was renamed Java EE, J2SE was renamed Java SE, and J2ME was renamed Java ME.
  • In December 2006, Sun released JRE 6.0.
  • On April 20, 2009, Oracle acquired Sun for $7.4 billion, obtaining the copyright to Java.
  • In November 2010, due to Oracle's unfriendliness toward the Java community, Apache threatened to withdraw from the JCP.
  • On July 28, 2011, Oracle released the official version of Java 7.0.
  • On March 18, 2014, Oracle released Java SE 8.
  • On September 21, 2017, Oracle released Java SE 9.
  • On March 21, 2018, Oracle released Java SE 10.
  • On September 25, 2018, Java SE 11 was released.
  • On March 20, 2019, Java SE 12 was released.

Java Development Tools

For the Java language, try to ensure that the system has more than 1G of memory. Other tools are as follows:

After installing the above tools, we can output Java's first program, "Hello World!"

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

In the next chapter, we will introduce how to configure the Java development environment.

Other extensions