If I create a new project from scratch I only have a src directory to start with.
If I then copy the contents of a class (e.g. from a web page giving example code) and right-click on the src directory in the project structure to paste it, a new class is created containing the contents.
However, the package structure of the class is not created.
The class is left in the src directory and the package statement is marked as an error.
The only quick fix available is to change the package name.
In the first place the package structure should have been created.
In the second case, the quick fix should have provided the option to create the package structure.