Reputation: 825
In C, there is this concept of header files that lets you include the header files required for most of the program in one go and so you can only import that one header file in each of your program. I find this pretty neat. Now, I have been working in JAVA for a while and afaik I cannot group together a set of imports that I require for almost every file and put them in one. Am I wrong? And is this better than putting all the required bunch in one java file.
Upvotes: 7
Views: 29194
Reputation: 12009
There's no such thing. If you require a class from another package (that isn't in java.lang), you'll have to import. But that's practically trivial when using a proper IDE. In Eclipse or NetBeans, you're usually one key combo away from fixing your imports.
Upvotes: 11
Reputation: 258618
There's no equivalent to header files in java, however you can import whole packages:
import mypackage.*
Upvotes: 4