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