is Java execution inefficient, but inefficient?

Source: Internet
Author: User

A lot of programmers who have not used Java or how to use Java can say that Java execution is inefficient, and this kind of talk is affecting me as a beginner Java developer from time to time.

Java execution inefficiencies are caused by (and C + + comparisons):

1,java does not allow the memory address type to be modified, nor can it directly manipulate memory directly to the memory address, as in C + +. C + + handles the memory address approach really directly when execution is very efficient, but also prone to bug,java when using objects, strictly follow the type conversion rules.

2,c++ has the delete operator after the new object to free up memory in a timely manner. Java has a garbage collection mechanism that automatically reclaims objects that are no longer needed after a certain period of time. This time difference is also the embodiment of efficiency.

3, an array that is specified as having 10 members, and C + + does not limit errors on this flexible operation when writing to a 11th member. The programmer does not limit the direct manipulation of memory.

In summary: Java is inefficient because of the limitations, the benefits are relatively few errors. No rules, inadequate surrounding area, I think the rule of law development is the idea of Java, Java developers free development of some of the rights to take back, but also limit the programmer to gallop memory, the bottom of the dream.

4, most importantly, Java program execution relies on the JVM (Java Virtual machine) as a bridge to link Java programs and operating systems, it is embarrassing that the JVM itself is implemented with C. Java program execution first compiled Java program as Java class file, and then through the JVM to be executed by the operating system, and C + + compiled directly by the operating system can be executed, the execution efficiency is not low! This feature is also an advantage of Java: cross-platform interoperability, Java class files can be executed on any JVM-supported platform, Windows,linux, but C + + code after Windows compiled can not be executed correctly on Linux system.

So Java's execution efficiency and C + + is not comparable, but everything has double-sided, inefficient execution, not necessarily inefficient. In general, Java is also a very good language.

is Java execution inefficient, but inefficient?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.