如何在我正在制作的整个应用程序中公开使用下面的双变量(周一、周二、周三等)?例如,如果我在最后一个大括号之后,则无法访问 mon 变量。有任何想法吗?
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;
}
});