How do i make the double variables below (mon, tues, wed, etc) available publically throughout my application that i am making? Like for example if i go after the last curly bracket the mon variable can not be accesed. Any ideas?
finalize.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
double mon = Double.parseDouble(monday.getText());
double tues = Double.parseDouble(tuesday.getText());
double wed = Double.parseDouble(wednesday.getText());
double thurs = Double.parseDouble(thursday.getText());
double fri = Double.parseDouble(friday.getText());
double sat = Double.parseDouble(saturday.getText());
double sun = Double.parseDouble(sunday.getText());
double sum = mon + tues + wed + thurs + fri + sat + sun;
}
});
You have to declare them on class level, as fields.
The inner class can access final local variables of the enclosing method, but that won’t work in your case as you change the values.