Comparing C with Java Components

Some things in Java work similiar to C and some others are radically different.

Header files

Java does not have a preprocessor nor does it separate declarations of classes or constants into separate files. But Java still has the need to learn declarations of classes in other java files when a new java file is compiled - if those classes should be used in the new file. The "import" statement directs the Java compiler to existing classes. The Java compiler can then extract the declaration information directly from compiled classes (.class files). This is a different mechanism for the same purpose.

Java Files

A class per file is the usual Java rule. This is like the module concept of C except that C does not enforce it.

Libraries

Java libraries are collections of classes and packages (which are again collections of classes in a separate namespace). All java external references are dynamic: the code referenced is not included in the compiled program. Instead, the Java classloader loads classes at runtime dynamically into the virtual machine. Note that the versioning problem of full dynamic link libraries has now turned into a versioning problem for individual classes.