Java characteristics

zhaozj2021-02-16  81

Advantages of Java language

Java language is an excellent programming language. Its biggest advantage is that the same code can be used with the platform, on Windows 9X, Windows NT, Solaris, Linux, MacOS, and other platforms. "Written, run everywhere", making it widely used on the Internet.

Since the Java language designers are very familiar with C language, it is well borrowed from the C language when designing. It can be said that the Java language is a programming language "also object-oriented" than the C language. The grammatical structure of the Java language is very similar to the syntax structure of the C language, which makes the C programmers learn the Java language easier.

Of course, if it is only a change to C change, then there will be no hot today's Java. Some useful new features provided by Java languages, making it easier to write "unveiled code" than C language than C languages.

These new features include:

1) Provide automatic management of memory, programmers do not need to be allocated in the program, release memory, those terrible memory allocation errors will not bother you;

2) Remove the puzzling of the C language, the "pointer" that is easily erroneous, makes up with other methods;

3) Avoid confusion of assignment statements (such as a = 3) and logical operation statements (such as A = = 3);

4) Canceled multiple inheritance of this complex facility.

Some explanations:

"Multiple Inheritance" is "object-oriented" terminology, we will be described in detail in Chapter 2.

These advantages are the background of Java, Java, with its powerful grant, multi-threaded religion and networking ability, popular worldwide, has gradually become a standard of handheld equipment, Internet, and intra-computer computer.

Some tips:

The Java language specification is open, you can find it on http://java.sun.com, reading the Java language specification is a good way to improve the level.

Key feature of Java language

The Java language has a lot of effective characteristics, attracting programmers, the most important thing:

Simple and effective

Java language is a fairly simple "object-oriented" programming language. The Java language has omitted all the difficult to understand, easily confusing features, such as header files, pointers, structures, units, operators overload, virtual basis, and the like. It is more rigorous, concise.

note:

Some readers who are familiar with the Visual Basic language feel that the Java language is complicated relative to VB, which is indeed more effortless to use VB. But everyone must know that VB is an integrated development tool that has become artifacts of the GUI program with visualization tools, but it is not a language. Its basis is the Basic language, which is the simplest language, but its function is not as complete as C, C , Java.

The Java language uses a special software constructor that can operate independently on a small machine. As long as 40K can accommodate a top most basic interpreter, even if you add basic standard libraries and thread support, you only need to add 175K. This is also a secret of success in the Java language.

2. High-profit portability

For a programmer, the program written can be run on Windows, Macos, UNIX and other platforms without modification, which is simply a good thing! The Java language makes this original unreachable thing getting closer. Using the program written in the Java language, just do less modifications, even sometimes do not need to modify it, you can run on a different platform.

For example, there is different regulations on the size of the data type on different platforms. On some platforms, the integer (int) is expressed in a 16-bit binary number, while the platform is represented by a 32-bit binary number. The C / C language does not shield this difference from different platforms. This way, if a C language source program developed on a platform using a 16-bit binary number is used, it is necessary to operate on a platform that uses a 32-bit binary number to represent an integer. In the Java language, this shielded this is different from the platform. The interaction in Java is that it is indicated by 32-bit binary, and the Java virtual machine is digested. When we want to use a 16-bit binary number to represent a Java language source program developed on a platform, port it to a platform that uses a 32-bit binary representation to operate, and it is not necessary.

The Java language has such high graft is an inevitable, because its design concept is "writing, run everywhere".

3. "Object-oriented"

It can be said that "object-oriented" is a revolution in software engineering, which greatly enhances human software development capabilities, is a great advancement, a major scapement for software development.

In the past 30 years, "object-oriented" has a long development, fully reflecting its value, and now has formed "object-oriented system analysis", "object-oriented system design", "object-oriented programming" A system. Therefore, as a modern programming language, it is not possible to deviate from this direction, and the Java language is no exception.

note:

The Java language is known as the C also "object-oriented" programming language, does not understand "object-oriented", it is difficult to use Java language, do not familiarize with readers of this aspect, you can read the second book. chapter.

4. Explanation type

Do you still remember the Basic language? When we use the Basic language to program, you have to enter the Basic language environment, then enter the source program, then run it, the Basic language environment explains, runs, and draws directly. This language is interpreted language.

And the language like C / C is not this, we first use the editing software or integrated development environment (IDE) to write the source program, then compile it, generate executables. Then we re-execute this executable result. This language is the compilation language.

The interpretation type is low, the speed is slow; the compilation type is high, and the speed is fast.

Java language is an interpreted language. Yes, no mistakes, it is an interpretation language, that is, relative to C / C language, the Java language writes low, slow execution speed. But it is the magnificent target for the Java code to implement the Java code on different platforms to implement the magnificent target of "once writing, run everywhere". In order to achieve the goal, the sacrificial efficiency is still worth it, and then, the current computer technology has changed, and the operation speed is getting faster and faster. Users will not feel too slow.

Some tips:

In fact, Java language is not as complete as the Basic language, which is a compromise that interpretation and compilation. Use the Java language to write programs, first write the source program with the Editing Software or Integrated Development Environment (IDE), then use the Java compiler to make a pseudo-compilation, compile it into an intermediate code (also known as one by section). Then use the Java interpreter to explain.

5. Suitable for distributed calculations

The Java language has powerful, easy to use networking capabilities, ideal for developing distributed computing procedures. Java applications can access remote objects via URL as accessing the local file system. Write the Socket communication program using the Java language is very simple, using it is simpler than using any other language. And it is also very suitable for developing the development of public gateway interface (CGI) scripts, and also use Java Applications (Applets), Java Server Page, JAVA Server Page, JSP, servlet, etc. to build richer Web page.

6. Have better performance

As mentioned earlier, since Java is an interpreted language, its execution efficiency will be slower, but due to the two means in Java language, it makes its performance is still good.

1) After the Java language source program is completed, first use the Java pseudo-compiler to perform pseudo-compilation, convert it into an intermediate code (also known as byte code), and then explain;

2) Provide a "Just-In-Time, JIT) compiler, when you need a faster speed, you can use the JIT compiler to convert the bytecode into a machine code, then buffer it down. This will be faster so fast.

Some tips:

This JIT compiler, as the name suggests, Just-in-Time, only in runtime, compiles it into platform-related machine code (due to the current operation, no need to consider portability). After this is processed, it can bring 10 times or even 20 times speed increase. Moreover, this technology is constantly being corrected. In the future, the JIT compiler will be more intelligent, and which code can be monitored frequently, thereby proper optimization, further speeding up the speed.

7. Strong, prevent problems

In the pseudo-compile, Java language has made many early potential problems, and many corresponding checks are made when running, which can be said to be the most stringent "compiler".

Its means of "preventing happening" will kill the mistakes in many programs in shake. There are often many errors that must be exposed by running in other languages, and they are found in the compilation phase.

In addition, in the Java language, many guarantees have been provided to ensure stable and robust characteristics, which effectively reduces errors, which makes Java applications more robust.

8. Has multi-threaded reliability

Threads, a lightweight process, is an essential characteristic of modern programming. Multi-threaded control makes programs to have better interactivity, real-time.

Java features superior in multi-threaded religions, with powerful features that make you surprises, and make multi-threaded processing in the Java language is simple.

note:

It should be noted that the mainstream platforms are unable to achieve thousands of threads, so Java language is temporarily unable to

This aspect is "unrelated to the platform", so Java has implemented a multi-threaded mechanism for different operating systems.

And for programmers, on different machines, calling multi-threading mechanisms is still the same.

9. Has high security

Since the Java language is designed, it is very careful in terms of security, making many explorations, making Java languages ​​into the current most secure programming language.

Although Sun has promised: "It can easily build a system of anti-virus and anti-black and anti-hand through Java", but "there is no absolute safety in the world" this truth will not be lost because of someone's promise.

Soon after JDK (Java Development Kit) was released soon, a set of security experts from the University of Princeton (Princeton) found the first error in Java 1.0 security characteristics. Since then, Java security issues have begun to be concerned. However, the safety hazards discovered so far are very insignificant, and the Java Development Group also claims that they attach great importance to system security, and they will immediately repair them. And because Sun has opened the details of the Java interpreter, it helps to use strength, joint discovery, prevention, and stop these safety hazards.

Some tips:

If your English reading ability is good, and it is very concerned about these security issues about Java, you can visit the following two newsgroups:

1) http://www.cs.princeton.edu/sip: Princeton University News Group

2) COMP.RISKS News Group

10. is a dynamic language

Java is a dynamic language that represents two aspects:

1) In the Java language, you can simply, intuitively query the runtime information;

2) You can add a new code to a running program.

11. Neutral object language

"Java compiler is a neutral object file format.

This neutral structure is actually not Java first. Before Java appears, the UCSD Pascal system has been in a commercial product. In addition, there is a precedent in this way before UCSD Pascal, that is, Niklaus Wirth implementation. This method of reducing some properties, replacing better portability and versatility is used in the Pascal language.

The Java's bytecode has been well designed, making it easy to compatibility with most popular computer systems today, can be easily interpreted on any machine, easy to dynamically translate into machine code.

转载请注明原文地址:https://www.9cbs.com/read-14439.html

New Post(0)