In java at least, my compiler won't let me put two (or more) separate classes in a single class file. It forces me to create multiple files in the same package. I understand why this is, and I agree with this principle. However, I've realized that I could just as easily nest the classes and contain the entire program (excluding imported libraries) in a single file. I would imagine that this would be frowned upon, but I don't understand why. What are the dangers and disadvantages of nesting class as opposed to the standard system (outside of the severe loss in organization and neatness)?
Well, if you keep everything in the same file, you lose packages and the private keyword does no longer have any meaning.
Given that most Java projects will be opened in an IDE that presents different classes as different tabs, you can have more that one cursor in the program.
Why would you have everything in the same file?
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