Differences between Java and C ++

Source: Internet
Author: User

1. cross-platform. The former is cross-platform. This is basically not the case for the latter.
2. Java removes some types that are prone to errors in C ++ or which Java designers think is unreasonable, such as pointers, struct, and consortium.

3. garbage collection. Java has an automatic garbage collection mechanism, eliminating the need for programmers to release garbage memory. The latter does not have this mechanism.

4. Inheritance. Classes in Java only support single inheritance, but do not support multiple inheritance. C ++ supports multiple orders. It should be noted that interfaces in Java support multi-inheritance. Java generally uses Java interfaces to implement multi-inheritance.

5. Java is a compilation and Interpretation Language. The latter is purely compiled. Of course this is just a small difference.

6. Operator Overloading is not supported in Java. C ++ supports. I wonder if the string connection in Java is a special case of operator overloading?

7. Java is a pure OO language. The latter is actually a compound language. There are both object-oriented and process-oriented parts.

8. Java does not have the include-like preprocessing function in C ++. However, it provides import statements similar to the functions of the C 10 processor.

If you consider it from the syntax perspective. There are many differences.

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.