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.
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.
There's no equivalent to header files in java, however you can import whole packages:
import mypackage.*
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With