I am developing JAVA programs in the Eclipse environment, not so much for the sake of the program, as for the sake of experience (although the program is also necessary, because the course)
the reason for contacting the professionals on the forum is an error java.lang.StackOverflowError - stack overflow. The situation in which the error occurs is as follows: in the first class of ClInitVisualElements, the handler for the button
btnOperationPoint.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent arg0){ screenManagement.AddPoint(); }});
calls the AddPoint () method; second class clScreenManagementOperations
public void AddPoint() { if (!bPointIn) visualLink.AddToLastPosition("."); }
AddPoint in turn checks for a comma in the string and then calls the first class method (bPointIn is a boolean type variable)
AddToLastPosition (); - the first class method from which the AddPoint () call was made
public void AddToLastPosition(String Text) { String StrTemp = TfDisplayOperation.getText(); TfDisplayOperation.setText(StrTemp+Text); }
here and without error it is clear that the recursion is present, but the singular one is a sequential call of three methods between two classes, for some reason there are errors that indicate two lines of code:
ClScreenManagementOperations screenManagement = new ClScreenManagementOperations();
first class link to second
ClInitVisualElements visualLink = new ClInitVisualElements();
reference in second grade to first
Please tell me how to solve the problem.
thanks in advance