In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the characteristics of Java language, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
1. Features of Java language
We mentioned earlier that Java is an object-oriented programming language that is cross-platform and suitable for distributed computing environments. To be specific
It has the following characteristics: simplicity, object-oriented, distributed, interpretive, reliable, secure, platform-independent, portable and high
Performance, multithreading, dynamic, etc. Next, we will focus on the object-oriented, platform-independent, distributed and multithreaded Java language.
Features such as reliability and safety.
one? object-oriented
Object-oriented is actually a natural extension of the real-world model. Any entity in the real world can be regarded as an object. Between objects
Interact with each other through messages. In addition, any entity in the real world can belong to a certain kind of thing, and any object belongs to a certain kind of thing.
An example. If traditional procedural programming languages are process-centric and algorithm-driven, object-oriented programming languages are
Object-centric and message-driven. Expressed by formula, the procedural programming language is: program = algorithm + data; object-oriented programming language
The words are: program = object + message.
All object-oriented programming languages support three concepts: encapsulation, polymorphism and inheritance, and Java is no exception. In the real world
All objects have properties and behaviors, which are mapped to computer programs, the attributes represent the data of the object, and the behavior represents the methods of the object.
Used to process data or interact with the outside world. The so-called encapsulation is to use an autonomous framework to connect the data and methods of an object.
As a whole. It can be said that the object is the means to support encapsulation and the basic unit of encapsulation. The Java language is more encapsulated because
Java has no full-range variables and no main function. In Java, most of the members are objects, only simple numeric types, character types and cloth.
Except for the type. For these types, Java also provides corresponding object types to interact with other objects.
Polymorphism is a variety of forms, specifically, it can be expressed as "one external interface, multiple internal implementation methods". Lift
For example, a stack in a computer can store data in a variety of formats, including integers, floats, or characters. No matter what kind of storage
The algorithm implementation of data and stack is the same. For different data types, programmers do not have to select them manually, they only need to use unified connection
The oral name can be selected automatically by the system. Operator overloading (operatoroverload) has always been regarded as an excellent embodiment of polymorphic mechanism.
But considering that it would make the program difficult to understand, Java finally canceled it.
Inheritance means that one object uses the properties and methods of another object directly. In fact, many of the entities we encounter have inherited
Meaning. For example, if a car is regarded as an entity, it can be divided into multiple sub-entities, such as trucks, buses and so on. These children are solid.
Bodies have the characteristics of cars, so cars are their "fathers", and these fruit entities are the "children" of cars. Java lift
Provide the user with a series of classes (class). The class of Java has a hierarchical structure, and the subclass can inherit the properties and methods of the parent class. With other people
Unlike object-oriented programming languages, Java only supports a single inheritance.
two? Platform independence
Java is a platform-independent language, which means that applications written in Java can run on different hardware and software platforms without modification. Flat
There are two kinds of station independence: source code level and object code level. C and C++ have a certain degree of source code-level platform irrelevance, indicating that using C or C++
The written application can run on different platforms without modification and simply recompiling.
Java mainly relies on Java virtual machine (JVM) to achieve platform independence at the target code level. JVM is an abstract machine that is attached to the tool
Above the body operating system, it has a set of virtual machine instructions, and has its own stack, register group and so on. But JVM is usually on the software.
It's not implemented in hardware. At present, SUN Systems has designed and implemented Java chips, which are mainly used in the network computer NC.
In addition, the emergence of Java chips will also make it easier for Java to be embedded in household appliances. JVM is the platform-independent foundation of Java, in JVM
There is a Java interpreter for interpreting programs compiled by the Java compiler. After writing the software, Java programmers use Java
The compiler compiles the Java source program into the bytecode of JVM. Any machine equipped with a Java interpreter can run this
Program, regardless of the platform on which the bytecode is generated. In addition, Java uses data types based on the IEEE standard.
Ensuring the consistency of data types through JVM also ensures the platform independence of Java.
The platform independence of Java has far-reaching significance. First of all, it makes programmers dream of developing a piece of software in
Running on any platform) becomes a reality, which will greatly accelerate and promote the development of software products. Secondly, the platform independence of Java is just right.
Combined with the idea of "network computer". If a large number of commonly used applications (such as word processors, etc.) are rewritten in Java, and
On an Internet server, users with NC will not need to take up a lot of space to install software, they only need a
Java interpreter, whenever you need to use an application software, you can download the bytecode of the software, and the running results can be sent back to the server.
Server. At present, several companies have begun to use this new computing model to build their own enterprise information systems.
three? Distributed system
Distribution includes data distribution and operation distribution. Data distribution means that data can be distributed on different hosts on the network.
Refers to the dispersion of a calculation on different hosts.
Java supports the WWW client / server computing model, so it supports both distributions. For the former, Java provides a
An object called URL, which allows you to open and access objects with the same URL address, access method and access
The local file system is the same. For the latter, Java's applet Mini Program can be downloaded from the server to the client, that is, part of the calculation is done on the client.
It is carried out at the household end to improve the execution efficiency of the system.
Java provides a set of network class libraries. Developers can use the class libraries to design network programs, and it is convenient to realize the division of Java.
Cloth characteristics.
four? Reliability and security
Java was originally designed to be used in electronic consumer products, so it requires high reliability. Although Java originates from Clover, it is
Eliminate a lot of C++ unreliable factors, can prevent many programming errors. First of all, Java is a strongly typed language that requires explicit methods
Declaration, which ensures that the compiler can find method call errors and ensure that the program is more reliable; second, Java does not support pointers, which
Illegal access to memory is eliminated; third, the automatic unit collection of Java prevents problems caused by dynamic memory allocation such as memory loss
Fourth, when the Java interpreter runs checks, it can find that array and string access is out of bounds. Finally, Java provides exception handling.
Mechanism, programmers can put a set of error codes in one place, which simplifies the error handling task and facilitates recovery.
Because Java is mainly used for network application development, it has high requirements for security. If there is no security guarantee, users
Downloading programs from the Internet for execution is very dangerous. Java uses its own security mechanism to prevent the generation of virus programs and download programs to this
The threat of destruction of the earth system. When Java bytecode enters the interpreter, it must first be checked by the bytecode verifier, and then Java
The interpreter will determine the memory layout of the classes in the program, and then the class loader is responsible for loading the classes from the network into a separate memory area.
Avoid interference and destruction between applications. Finally, client users can also restrict access to certain texts for classes loaded from the network
Piece system.
The combination of the above mechanisms makes Java a secure programming language.
five? Multithreading
Thread is a new concept of the operating system, which is also called lightweight process. It is a smaller concurrently executable unit than traditional process.
C and C++ adopt a single-threaded architecture, while Java provides multithreaded support.
Java supports multithreading in two ways. On the one hand, the Java environment itself is multithreaded. Several system threads are responsible for running as necessary
System-level operations such as useless unit recovery and system maintenance; on the other hand, Java language has built-in multithread control, which can greatly simplify multiline
Program application development. Java provides a class Thread that is responsible for starting the run, terminating the thread, and checking the state of the thread. Java
The thread also includes a set of synchronization primitives These primitives are responsible for concurrency control over threads. Using the multithreading programming interface of Java, the developer
Staff can easily write applications that support multi-threading and improve the efficiency of program execution. It must be noted that Java's multithreading support is in a
To some extent, it is limited by the runtime support platform. For example, if the operating system itself does not support multithreading, the multithreading feature of Java
You may not show it.
II. Java Mini Program and applications
There are two types of programs you can write with Java: Mini Program (also known as JavaApplet) and JavaApplication. Xiao Cheng
A preface is a Java program embedded in an HTML document; a Java application is a program that runs from the command line. For Java, Java Mini Program
There is no limit to its size and complexity. In fact, Java Mini Program is in some ways more powerful than Java applications. But due to the current situation
Internet communication speed is limited, so most Mini Program is small. The technical difference between Mini Program and applications lies in the running environment.
The Java application runs in the simplest environment, and its only external input is command-line arguments. Java Mini Program, on the other hand, needs
There is a lot of information from the Web browser: it needs to know when to start, when to put it in the browser window, where, and when to activate and close. Due to
The minimum requirements for these two different execution environments are different for Mini Program and applications.
Because WWW makes the release of Mini Program very convenient, Mini Program is more suitable as an application on Internet. On the contrary, non-network departments
Systems with less Tonghe memory are more suitable for using Java applications and less Java Mini Program for implementation. In addition, Java applications are easy to use with
Internet-based environment, in fact, some good Java applications are just like this.
Thank you for reading this article carefully. I hope the article "what are the characteristics of Java language" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.