Differences between Java and C

Source: Internet
Author: User
Tags constant definition

1. Java does not have preprocessing commands. (For example, # define, # include, # ifdef, etc. in C ). The constant definition in C is replaced by static final in Java.

2. Java does not contain global variables in C.

3. The size of the main type in Java is determined, and the size of the main type in C is related to the platform.

4. Java does not have a pointer. It uses a similar handle to replace the pointer. However, Java does not allow addition or subtraction of the handle, and there is no such thing as an address operator.

5. Java has a garbage collection mechanism, so you do not need to release the space yourself.

6. Java does not have a goto statement. Java adds Exception Handling and label break and continue statements based on the control statements provided by C. These functions can replace goto.

7. C requires that the definitions of all local variables used in a method or block be defined at the beginning of the method or block, and Java allows these definitions to appear anywhere in the method or block.

8. Java does not require you to define a function before calling it. It can be defined after the call point. C has this requirement.

9. Java does not support the strut and union types in C. Java supports method overloading.

10. Java does not support the enum keyword in C.

11. Java does not support bitfields in C.

12. Java does not support C typedef.

13. Java does not support C method pointers.

14. Java does not support Variable Parameter tables of C.

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.