Why is it not recommended to use default package in JAVA? Though I understand it makes more sense to have a more reasonable and descriptive package names for maintainability and readability purposes, but are there any other reasons behind it?
Why use of default package is not recommended in JAVA?
1k Views Asked by aamir At
2
Package naming conventions are to prevent namespace collisions.
If you create a class called "Test" and thousands of other people also create classes with that name because you are using different package names they don't clash.
If you never publish your code it's not such a big deal but if you ever release a library you need to use proper packages. Even for your own projects it takes very little time to do it properly so it's best to get into good habits early.