I’m feeling lost as to how to do this. I am trying to perform a calculation with a value that needs to be a global variable. but to be global it has to be static. I need the for loop to be static too so it can perform the calculation in the array but I can’t remember how to do this.
The very last line of code is where I am stuck currently due to “Cannot find symbol” errors. I am trying to find a way to bring yVal0 in to this method so I can perform the calculation
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class RegressionGUI extends JFrame
implements ActionListener {
private JLabel VariableLabel = new JLabel("Select one independent Variable");
Again, I doubt that you need to use static anything, and a quick review of your (poorly formatted) code suggests that this is still so. Why not instead make some of your numeric variables class fields and not method-local or constructor-local so you can use them in any non-static method of the class?
e.g.,