Ever noticed that Java has no header files? Instead, Java uses one file to store each public class and its functions.
Why would they require each class to have its own file? It’s a question of simplicity for the Java designers. The Java precompiler (as it were) builds class symbols using the file names, which means that the developers don’t have to worry about collisions (as you can’t have two files with the same path but different contents).
There are pros and cons to this approach. On the one hand, if you have the right class file in your project, you have all the contents of that class available. On the other hand, you have to include EVERY class file you want individually. This basically requires you to use an IDE and/or .jar files to get everything in place and set up properly.
It is an inherently object oriented approach. Whether it’s superior or inferior to the C/C++ header system is a matter for debate. My position is that it makes libraries largely impossible to develop, because each project needs to carry the full content of every .jar file you include, whether the content is necessary or not. This means that every Java project carries with it every piece of every library, while C/C++ programs only need to carry those pieces required to execute the functions in that program. It might not seem that significant, but it can be the difference between 100KB and 100 MB for some extreme cases.