I have defined two classes for a java program I am writing, call them Class1 and Class2. In the body of the constructor for Class1, I call the constructor for class 2. Howev
Make sure that you have entered correct package names in your classes.
This is an addition to the answer of Grease. (I can't add a comment due to lack of reputation.)
I sometimes run into the same issue and always deleted the complete folder, so NetBeans had to rebuild the maven-stuff which can take a few minutes.
If someone uses maven and don't want NetBeans has to completely rebuild the maven repos and -index, don't delete the following folders in the NetBeans cache folder:
Just tested it with NetBeans 11.3: Not deleting the three folders makes the error(s) go away but don't bothers maven. I could imagine that this is the same with older versions of NetBeans.
I had the same issue and the solution was very simple in my case.
The case:
I copy/paste some classes from another project in a package of the project I am working in.
Some of them had the old package declaration and the compiler didn't complained (for his reasons).
When I used a method with return type one of the 'wrong packaged' classes this error appeared.
(The Type of is erroneous)
The solution
To solve the issue, I changed the package declaration to be the correct one!