I have this problem since I’m beginning in OOP programming I want to close one Class from other Class who have been called by this Class I want to close.
EX:
Class Principal call Class Menu and inside menu i close Principal
//Im inside of Principal
Menu mnu = new Menu();
//Now im inside of Menu
public void closePrincipal(){
principal.close();
}
You can pass the reference to the principal class to the menu;
// in your principal
You have to define that constructor in the Menu class:
So when you want to use it in your menu, just do it.