Hi, there. I am working on project that has many objects that have cross dependency problem, for example. A calls B and B class A. As a result, many objects can't compile if they are not in the same package. is there a way where I can get the classes to compile without change many lines of code. for example: ------ A.java ------ package example1; public class A {
public void printB() { System.out.println("In printB: "); B b = new B(); b.printA();
} public static void main(String args) { A a = new A(); a.printB(); B b = new B(); b.printA();
}
} --------- B.java ------------ package example2;
public class B {
public void printA() { System.out.println("In printA: "); A a = new A(); a.printB();
} }
-----------------------------------------
expired user
Greenhorn
Joined: Dec 13, 2001
Posts: 11
posted
0
I suppose that u have to import the packages inorder to access the class and in turn the methods defined in those classes. Without importing Java doesn't know anything about the class A or B, in your case. Try with this import package.class; import package.*;
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.