Using the default Java package in Eclipse

In Eclipse, when I start a new project, I look through the wizard, and when I start writing my first class for this project, I am asked to choose a package. Sometimes out of laziness I just choose the default package.

The master warns me that this is discouraged. Even if I ignore the warnings, I will never have problems with the application because of this. Or at least so far I have never had a problem.

So why does Eclipse want me to create a new package?

+7
source share
2 answers

Eclipse and most other IDEs are tied to large projects. Programmers programming and small tasks can often be performed in the IDE, but keep in mind that a common assumption would be for larger projects - only from 10 to 5000+ classes.

There is also the possibility of creating a class that has a similar name for the Java API, for example:

The ambiguity in creating an instance of a class ( throw new MarshalException(); ) if both classes exist in the same class path is a compilation error.

+10
source

In fact, you cannot import classes from the default package. I understand that this is allowed for convenience or for very small (one class file) tasks.

0
source

All Articles