Change the constructor of the second class to
public class Sc {
private Mc mc;
/**
* Constructor
*/
public Sc(Mc mc) {
this.mc = mc;
}
}
and call the constructor like so
Mc mainclass = new Mc();
Sc secondclass = new Sc(mainclass);
Now you can call methods of class Mc via the mc member of class Sc.
EDIT
Based on the [pseudo] code linked to in this comment, consider the following.
Class Home
package homeshop;
import javax.swing.JButton;
public class Home {
private JButton[] buttons;
public Home() {
new Shop(this);
}
void homeOpen() {
for (int i = 0; i < buttons.length; i++) {
buttons[i].setVisible(true);
}
}
}
Class Shop
package homeshop;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
public class Shop {
private Home home;
private JButton[] buttons;
public Shop(Home home) {
this.home = home;
buttons[0].addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
home.homeOpen();
}
});
}
}
Method homeOpen, in class Home, has package access so that it can be called from class Shop since both classes are in the same package. Also note that I changed the method name so as to adhere to Java naming conventions.