need help to call another class
hi,
some examples i found online to call another class but during practice i stuck in GUI once i call another class. hope somebody can help me pls..
i have one class name 'nestedLoop' that makes output: 60
Code:
public class nestedLoop {
public static void main(String[] args) {
int sum=0 ;
for (int i=0; i<5; i++) { sum+= i;
for (int j=0; j<5; j++) {sum =sum+j;} }
System.out.print(sum);
}
}
and now i have a GUI where has button 'showResult' to show that output in TextArea..
Code:
public void actionPerformed(ActionEvent e) {
if (e.getSource()==showResult)
nestedLoop np= new nestedLoop();
{txtArea.setText(np.getText); }
what should i write instead of txtArea.setText(np.getText) ??