Hi all

I tried todo javac command on two classes (one after another)
the problem is when I javac the first it gives me error ,because class of the second not already exist,the same happen when i javac the second ,class of the first also not already exist.
how to overcome ?

thank you
denny

class home{
 
	     int lastMenu;
	     SubMenu subMenu = new SubMenu(this);
	     int getLastMenu() {
	         return lastMenu;
	     
	}
	}
class SubMenu {
	     home father;
	     // constructor
	     SubMenu(home father) {
	        this.father = father;
	     }
	
	      int lastMenu = father.getLastMenu();
	
}

Recommended Answers

declare the classes as public

Jump to Post

All 3 Replies

declare the classes as public

Remember that you can pass multiple files to javac to compile. Instead of doing them separately, try javacing them at the same time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.