Java Intro
Java is a general term for the Java object-oriented programming language and Java platform, launched by Sun Microsystems in May 1995. It was jointly developed by James Gosling and his colleagues and officially released in 1995.
Later, Sun was acquired by Oracle, and Java subsequently became an Oracle product.
Java is divided into three systems:
* JavaSE (J2SE) (Java 2 Platform Standard Edition)
* JavaEE (J2EE) (Java 2 Platform, Enterprise Edition)
* JavaME (J2ME) (Java 2 Platform Micro Edition).
In June 2005, at the JavaOne conference, Sun publicly released Java SE 6. At this 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
* **Java is Simple:**
The syntax of the Java language is very close to C and C++, making it easy for most programmers to learn and use. On the other hand, Java discards the rarely used, hard-to-understand, and confusing features of C++, such as operator overloading, multiple inheritance, and automatic type casting. In particular, Java does not use pointers but references. It also provides automatic memory allocation and garbage collection, freeing programmers from concerns about memory management.
* **Java is Object-Oriented:**
Java provides object-oriented features such as classes, interfaces, and inheritance. For simplicity, it only supports single inheritance between classes but supports multiple inheritance between interfaces and the implementation mechanism between classes and interfaces (using the keyword `implements`). Java fully supports dynamic binding, whereas C++ only uses dynamic binding for virtual functions. In summary, Java is a pure object-oriented programming language.
* **Java is Distributed:**
Java supports the development of Internet applications. The basic Java Application Programming Interface includes a network application programming interface (`java.net`), which provides class libraries for network programming, including `URL`, `URLConnection`, `Socket`, `ServerSocket`, etc. Java's RMI (Remote Method Invocation) mechanism is also an important means for developing distributed applications.
* **Java is Robust:**
Java's strong typing, exception handling, and automatic garbage collection are important guarantees of the robustness of Java programs. Discarding pointers was a wise choice for Java. Java's security checking mechanism makes Java more robust.
* **Java is Secure:**
Java is often used in network environments. To this end, Java provides a security mechanism to prevent attacks by malicious code. In addition to many security features inherent in the Java language, Java has a security mechanism for classes downloaded over the network (the `ClassLoader`), such as assigning different namespaces to prevent replacing local classes of the same name, bytecode checking, and providing a security management mechanism (the `SecurityManager`) to allow Java applications to set up security sentinels.
* **Java is Architecture-Neutral:**
Java programs (files with the `.java` suffix) are compiled on the Java platform into an architecture-neutral bytecode format (files with the `.class` suffix), which can then be run on any system that implements the Java platform. This approach is suitable for heterogeneous network environments and software distribution.
* **Java is Portable:**
This portability stems from its architecture neutrality. Additionally, Java strictly defines the length of each primitive 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.
* **Java is Interpreted:**
As mentioned earlier, Java programs are compiled into bytecode format on the Java platform and can then be run on any system that implements the Java platform. At runtime, the Java interpreter in the Java platform interprets and executes these bytecodes. The classes needed during execution are loaded into the runtime environment during the linking phase.
* **Java is High-Performance:**
Compared to interpreted high-level scripting languages, Java is indeed high-performance. In fact, with the development of JIT (Just-In-Time) compiler technology, Java's execution speed is increasingly approaching that of C++.
* **Java is Multithreaded:**
In the Java language, a thread is a special object that must be created by the `Thread` class or its subclasses. There are generally two ways to create threads: first, using a constructor of the form `Thread(Runnable)` to wrap an object that implements the `Runnable` interface into a thread; second, deriving a subclass from the `Thread` class and overriding the `run` method, where the object created from this subclass is the thread. It is worth noting that the `Thread` class has already implemented the `Runnable` interface, so every thread has its `run` method, which contains the code that the thread is to execute. Thread activity is controlled by a set of methods. Java supports the simultaneous execution of multiple threads and provides synchronization mechanisms between threads (using the keyword `synchronized`).
* **Java is Dynamic:**
One of the design goals of the Java language is to adapt to a dynamically changing environment. Classes needed by a Java program can be dynamically loaded into the runtime environment and can also be loaded over the network. This also facilitates software upgrades. Additionally, classes in Java have a runtime representation, allowing for runtime type checking.
* * *
## Development History
* May 23, 1995: Java language was born
* January 1996: The first JDK - JDK 1.0 was born
* April 1996: 10 major operating system vendors announced they would embed JAVA technology in their products
* September 1996: About 83,000 web pages used JAVA technology for development
* February 18, 1997: JDK 1.1 was released
* April 2, 1997: JavaOne conference was held, with over 10,000 participants, setting a record for the largest global conference of its kind at the time
* September 1997: The JavaDeveloperConnection community had over 100,000 members
* February 1998: JDK 1.1 was downloaded over 2,000,000 times
* December 8, 1998: JAVA2 Enterprise Platform J2EE was released
* June 1999: Sun released three versions of Java: Standard Edition (JavaSE, formerly J2SE), Enterprise Edition (JavaEE, formerly J2EE), and Micro Edition (JavaME, formerly J2ME)
* May 8, 2000: JDK 1.3 was released
* May 29, 2000: JDK 1.4 was released
* June 5, 2001: NOKIA announced it would sell 100 million Java-enabled mobile phones by 2003
* September 24, 2001: J2EE 1.3 was released
* February 26, 2002: J2SE 1.4 was released, significantly enhancing Java's computing capabilities
* September 30, 2004, 18:00 PM: J2SE 1.5 was released, becoming another milestone in the history of the Java language. To signify the importance of this version, J2SE 1.5 was renamed Java SE 5.0
* June 2005: At the JavaOne conference, Sun publicly released Java SE 6. At this 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
* December 2006: Sun released JRE 6.0
* **April 20, 2009: Oracle acquired Sun for $7.4 billion, obtaining the copyright to Java.**
* November 2010: Due to Oracle's unfriendliness toward the Java community, Apache threatened to withdraw from the JCP.
* July 28, 2011: Oracle released the official version of Java 7.0.
* March 18, 2014: Oracle released Java SE 8.
* September 21, 2017: Oracle released Java SE 9
* March 21, 2018: Oracle released Java SE 10
* September 25, 2018: Java SE 11 was released
* March 20, 2019: Java SE 12 was released
* * *
## Java Development Tools
The Java language tries to ensure the system memory is above 1G. Other tools are as follows:
* Linux systems, Mac OS systems, Windows 95/98/2000/XP, WIN 7/8 systems.
* [Java JDK 7, 8β¦β¦](http://www.oracle.com/technetwork/cn/java/javase/downloads/index.html)
* (https://code.visualstudio.com/) editor or other editors.
* IDE: (http://www.eclipse.org/downloads/), (https://www.jetbrains.com/idea/), (https://netbeans.org/), etc.
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.
YouTip