import two variable to two packages java

Viewed 46

I need to control variable var1 in class cls1 in package pack1 from pack2 therefore:

package pack2;   
import static int pack1.cls1.var1;

also need to control var2 in cls2 in pack2 from pack1;

but if write:

package pack1;
import static int  pack2.cls2.var2;

I have circular dependency, this solution not good for me,

Java: Is it bad practice to have a circular dependency within the same package?

EDIT2:

Of course, it is clear that circular dependency is not created under these conditions and my real problem, which included circular dependency, was not summarized correctly.

0 Answers
Related