Introduction to Java


Java is the general name 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 colleagues and officially launched in 1995.

Java is divided into three systems:

  • JavaSE (J2SE) (Java2 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 released Java SE 6. At this time, 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 language is simple:

    The syntax of Java language is similar to that of C language and C++ The language is close, making it easy for most programmers to learn and use. On the other hand, Java discards those features of C++ that are rarely used, difficult to understand, and confusing, such as operator overloading, multiple inheritance, and automatic casts. In particular, the Java language does not use pointers, but references. It also provides automatic waste collection so that programmers don't have to worry about memory management.

  • The Java language is object-oriented:

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

  • The Java language is distributed:

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

  • The Java language is robust:

    Java’s strong typing mechanism, exception handling, automatic garbage collection, etc. are the key to the robustness of Java programs Important guarantee. Discarding pointers is a smart choice for Java. Java's security checking mechanism makes Java more robust.

  • The Java language is safe:

    Java is usually used in a network environment. For this reason, Java provides a security mechanism to prevent Malicious code attacks. In addition to the many security features of the Java language, Java has a security prevention mechanism (class ClassLoader) for classes downloaded through the network, such as allocating different name spaces to prevent replacement of local classes with the same name, byte code inspection, and providing security management Mechanism (class SecurityManager) allows Java applications to set up security sentries.

  • The Java language is architecture neutral:

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

  • The Java language is portable:

    This portability comes from architecture neutrality. In addition, Java also strictly stipulates 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 running environment is implemented in ANSI C.

  • The Java language is interpreted:

    As mentioned above, Java programs are compiled into bytecode format on the Java platform. It can then be run on any system that implements this Java platform. At runtime, the Java interpreter in the Java platform interprets and executes these bytecodes, and the classes required during the execution are loaded into the running environment during the connection phase.

  • Java is high-performance:

    Compared with those 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 multi-threaded:

    In the Java language, a thread is a special object, which must be represented by the Thread class or Its descendants (grandchildren) classes are created. There are usually two ways to create a thread: first, use the constructor of type Thread(Runnable) to wrap an object that implements the Runnable interface into a thread; second, derive a subclass from the Thread class and override run Method, the object created using this subclass is a thread. It is worth noting that the Thread class has implemented the Runnable interface, so any thread has its run method, and the run method contains the code to be run by the thread. 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 Java programs can be dynamically loaded into the running environment, or the required classes can be loaded through the network. This also facilitates software upgrades. In addition, classes in Java have a run-time representation and can perform run-time type checking.


Development History

  • On May 23, 1995, the Java language was born

  • In January 1996, the first JDK-JDK1.0 was born

  • In April 1996, the 10 most important operating system vendors stated that they would embed JAVA technology in their products

  • In September 1996, about 83,000 web pages were produced using JAVA technology

  • February 18, 1997, JDK1.1 Release

  • On April 2, 1997, the JavaOne conference was held with more than 10,000 participants, setting a record for the scale of similar conferences in the world at that time

  • In September 1997, the JavaDeveloperConnection community had more than 100,000 members

  • In February 1998, JDK1.1 was downloaded more than 2,000,000 times

  • On December 8, 1998, JAVA2 enterprise platform J2EE was released

  • In June 1999, SUN released three versions of Java: Standard Edition ( JavaSE, formerly J2SE), Enterprise Edition (JavaEE formerly J2EE) and Micro Edition (JavaME, formerly J2ME)

  • On May 8, 2000, JDK1.3 was released

  • On May 29, 2000, JDK1.4 was released

  • On June 5, 2001, NOKIA announced that it would sell 100 million by 2003 All mobile phones that support Java

  • On September 24, 2001, J2EE1.3 was released

  • On February 26, 2002, J2SE1.4 Released, since then Java's computing power has been greatly improved

  • At 18:00PM on September 30, 2004, J2SE1.5 was released, becoming another milestone in the history of Java language development. In order to express the importance of this version, J2SE1.5 was renamed Java SE 5.0

  • In June 2005, the JavaOne conference was held, and SUN released Java SE 6. At this time, various versions of Java have been renamed to remove the number "2": J2EE was renamed Java EE, J2SE was renamed Java SE, and J2ME was renamed Java ME

  • 2006 In December 2009, SUN released JRE6.0

  • On April 20, 2009, Oracle acquired Sun for US$7.4 billion. Obtain the copyright of java.

  • In November 2010, Apache threatened to withdraw from JCP[4] due to Oracle's unfriendliness towards the Java community.

  • On July 28, 2011, Oracle released the official version of java7.0.


Java development tools

The Java language tries to ensure that the system memory is above 1G. Other tools are as follows:

  • Linux system or Windows 95/98/2000/XP, WIN 7/8 system

  • Java JDK 7

  • Notepad editor or Other editors.

  • IDE: Eclipse

After installing the above tools, we can output the first program of Java "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.