Getting Started with Java

Introduction to Java

Java is a general term for the Java object-oriented programming language and Java platform introduced by Sun Microsystems in May 1995. Co-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)
  • Java ME (J2ME) (Java 2 Platform Micro Edition, Java Platform, Micro Edition).

In June 2005, the JavaOne conference was held. SUN released Java SE 6. At this time, various versions of Java have been renamed to cancel the number “2”: J2EE changed its name to Java EE, J2SE changed its name to Java SE, and J2ME changed its name to Java ME.

The main features

  • The Java language is simple:

    The syntax of the Java language is very similar to the C and C++ languages, making it easy for most programmers to learn and use. On the other hand, Java discards those confusing features rarely used in C++, such as operator overloading, multiple inheritance, and automatic casts. In particular, the Java language does not use pointers but references. And provides automatic waste collection, so that programmers do not have 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 the sake of simplicity, only single inheritance between classes is supported, but multiple inheritance between interfaces is supported, and the implementation mechanism between classes and interfaces is supported (keyword is Implements). The Java language fully supports dynamic binding, whereas 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. In the basic Java application programming interface, there is a network application programming interface (java net), which provides a class library for network application programming, including URL, URLConnection, Socket, ServerSocket and so on. Java’s RMI (Remote Method Activation) mechanism is also an important means of developing distributed applications.

  • The Java language is robust:

    Java’s strong type mechanism, exception handling, and garbage collection are important guarantees for the robustness of Java programs. Discarding pointers is a wise choice for Java. Java’s security check mechanism makes Java more robust.

  • The Java language is safe:

    Java is often used in a networked environment. To this end, Java provides a security mechanism against malicious code attacks. In addition to the many security features that the Java language has, Java has a security mechanism (class ClassLoader) for classes downloaded over the network, such as assigning different namespaces to prevent substitution of local class names, byte code checking, and providing security management. The mechanism (class SecurityManager) lets Java applications set up security sentries.

  • The Java language is architecture-neutral:

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

  • The Java language is portable:

    This portability comes from the 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. The Java operating environment is implemented in ANSI C.

  • The Java language is interpreted:

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

  • Java is high performance:

    Java is indeed high performance compared to the interpreted advanced scripting language. In fact, the speed of Java is getting closer and closer to C++ with the development of JIT (Just-In-Time) compiler technology.

  • The Java language is multi-threaded:

    In the Java language, a thread is a special object that must be created by the Thread class or its descendants. There are usually two ways to create a thread: First, use a constructor of type Thread (Runnable) to wrap an object that implements the Runnable interface into a thread, and 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 already implements the Runnable interface, so any thread has its run method, and the run method contains the code that the thread wants to run. The activity of the thread is controlled by a set of methods. The Java language supports the simultaneous execution of multiple threads and provides synchronization mechanisms between multiple threads (keyword is synchronized).

  • The Java language is dynamic:

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

Development History

  • May 23, 1995, the birth of the Java language
  • In January 1996, the first JDK-JDK1.0 was born
  • In April 1996, 10 major operating system vendors stated that they will embed JAVA technology in their products.
  • In September 1996, about 83,000 web pages were created using JAVA technology.
  • February 18, 1997, JDK1.1 released
  • On April 2, 1997, the JavaOne conference was held with over 10,000 participants, setting a record for the scale of similar conferences of the world at the time.
  • In September 1997, more than one hundred thousand members of the JavaDeveloperConnection community
  • In February 1998, JDK1.1 was downloaded more than 2,000,000 times
  • December 8, 1998, JAVA2 enterprise platform J2EE released
  • In June 1999, SUN released three versions of Java: Standard Edition (JavaSE, formerly J2SE), Enterprise Edition (JavaEE was formerly J2EE), and Micro Edition (JavaME, formerly J2ME)
  • May 8, 2000, JDK1.3 released
  • May 29, 2000, JDK1.4 released
  • On June 5, 2001, NOKIA announced that it will sell 100 million Java-enabled mobile phones by 2003
  • September 24, 2001, J2EE1.3 released
  • On February 26, 2002, J2SE1.4 was released, and Java’s computing power has improved dramatically since then.
  • At 18:00 PM on September 30, 2004, the release of J2SE1.5 became another milestone in the history of Java language development. In order to indicate the importance of this version, J2SE1.5 was renamed Java SE 5.0
  • In June 2005, the JavaOne conference was held. SUN released Java SE 6. At this time, various versions of Java have been renamed to cancel the number “2”: J2EE changed its name to Java EE, J2SE changed its name to Java SE, and J2ME changed its name to Java ME.
  • In December 2006, SUN released JRE6.0
  • On April 20, 2009, Oracle acquired 7.4 billion U.S. dollars. Get the copyright of java.
  • In November 2010, Apache threatened to withdraw from the JCP [4] due to Oracle’s unfriendliness of the Java community.
  • On July 28, 2011, Oracle released the official version of java7.0.
  • On March 18, 2014, Oracle Corporation released Java SE 8.

Java development tools

The Java language tries to ensure that the system has more than 1G memory. The 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 section we will describe how to configure the java development environment.