Reputation: 1
I have a Java project built using IDEA and Maven. To make this question simple: suppose part of the structure of the project is src -> main -> java In java folder there is a package called PAK, for example, which contains class A. Also there is class B in java folder without package. The problem is when I'm trying next code
package PAK;
public class A {
private B variable;
}
compiler can't see class B but class B is public.
Upvotes: 0
Views: 75
Reputation: 10249
You need to import the class B, because it's not in the same package with A
package PAK;
import B;
public class A {
private B variable;
}
If classes are in the same package, you don't need to import them.
Upvotes: 2