Why Java does not have a header file

Source: Internet
Author: User

http://bbs.csdn.net/topics/100134244

The need for a header file (. h) for C/s + + is two useful, one is to share the same definition between each compilation unit (Compile unit) when developing the compilation, and one is to let the user know the calling interface when publishing the library.

The Java program's target code (which is the final executable program), is actually the intermediate code (i.e., bytecode), which has a strong self-explanatory nature. For example, if you get a. class file, you will be able to know the class name inside it, the properties it contains, the method, and so on, which means that all the calling interfaces are known (and of course, you need a document-the development manual). A. Class itself combines the dual functions of "target Code" and "Interface definition", so a separate header file is no longer required.

Http://www.cnblogs.com/sky-zhang/archive/2012/06/01/2530426.html

Importing the. class file in Java, the. class file contains definitions of the methods, properties, and so on, and therefore does not require. h header files, and C or C + + compiled binary code does not contain information about functions and classes, in order to check the function format legitimacy at compile time, given by the. h file.

The. class file that Java provides to the user, although it contains complete information about the class, is "unreadable" to the developer, so it is also necessary to provide a declaration of the class in the form of a document.

Why Java does not have a header file

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.