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

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

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.