May 10, 2021 Java
Java is the general term for the Java object-oriented programming language and Java platform introduced by Sun Microsystems in May 1995. Developed by James Gosling and colleagues and officially launched in 1995.
Java is divided into three systems:
In June 2005, the JavaOne Conference was held and SUN disclosed Java SE 6. A t this point, 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 syntax of the Java language is very close to that of the C language and the C language, making it easy for most programmers to learn and use. J ava, on the other hand, discards rarely used, hard-to-understand, and confusing features in C+ , such as operator overloading, multi-inheritance, and automatic cast-type conversion. I n particular, the Java language does not use pointers, but references. It also provides automatic scrap collection so that programmers don't have to worry about memory management.
The Java language provides pronirs such as classes, interfaces, and inheritance, and for simplicity, only single inheritance between classes is supported, but multi-inheritance between interfaces is supported, and implementation mechanisms between classes and interfaces (keywords are implements). T he Java language fully supports dynamic binding, while the C-language uses dynamic binding only for virtual functions. In summary, the Java language is a pure object-oriented programming language.
The Java language supports the development of Internet applications, and there is a network application programming interface (java net) in the basic Java application programming interface, which provides a class library for network application programming, including URLs, URLConnection, Socket, ServerSocket, and so on. Java's RMI (Remote Method Activation) mechanism is also an important means of developing distributed applications.
Java's strong type mechanism, exception handling, automatic collection of garbage, etc. are important guarantees for the robustness of Java programs. D iscarding pointers is a smart choice for Java. Java's security checks make Java more robust.
Java is typically used in network environments, and for this reason Java provides a security mechanism against attacks by malicious code. In addition to the many security features that the Java language has, Java has a security guard mechanism (ClassLoader) for classes downloaded over the network, such as assigning different namespaces to prevent overrides of local classes of the same name, byte code checking, and providing a security management mechanism (Class SecurityManager) that lets Java applications set up security sentinels.
Java programs (files with java suffixes) are compiled into an architecturally neutral bytecode format (files with a suffix of class) on the Java platform and can then run on any system that implements the Java platform. This approach is suitable for heterogeneous network environments and software distribution.
This portability stems from architectural neutrality, and Java strictly dictates the length of each base data type. The Java system itself is highly portable, the Java compiler is implemented with Java, and the Java operating environment is implemented with ANSI C.
As mentioned earlier, Java programs are compiled into bytecode formats on the Java platform and can then run on any system that implements the Java platform. At runtime, Java interpreters in the Java platform interpret these bytecodes, and the classes required during execution are loaded into the running environment during the join phase.
Java is indeed high-performance compared to those interpreted advanced scripting languages. In fact, Java is getting closer and closer to C with the development of just-In-Time compiler technology.
In the Java language, a thread is a special object that must be created by the Thread class or its children (grandchildren) class. T here are usually two ways to create threads: one is to wrap an object that implements the Runnable interface into a thread using a constructor that is constructed as Thread, and the other is to derive sub-classes from the Thread class and override the run method, using objects created by that sub-class as threads. I t is worth noting that the Thread class has implemented the Runnable interface, so any thread has its run method, which contains the code that the thread wants to run. T he activity of a thread is controlled by a set of methods. The Java language supports simultaneous execution by multiple threads and provides a synchronization mechanism between multiple threads (keyword synchronized).
One of the design goals of the Java language is to adapt to dynamic environments. T he classes required by java programs can be dynamically loaded into the operating environment, or they can be loaded over the network. T his also facilitates software upgrades. In addition, classes in Java have a run-time represented and can perform type checks for run-time.
The Java language tries to ensure that the system has more than 1G of memory, and the other tools are as follows:
Once the above tools are installed, we can output Java's first program, Hello World! "
public class MyFirstJavaProgram {
public static void main(String []args) {
System.out.println("Hello World");
}
}
In the next section we'll show you how to configure the java development environment.