Cannot refer to a non-final variable inside an inner class defined in a different method

前端 未结 20 2271
一向
一向 2020-11-21 05:04

Edited: I need to change the values of several variables as they run several times thorugh a timer. I need to keep updating the values with every iteration through the timer

20条回答
  •  逝去的感伤
    2020-11-21 05:37

    what worked for me is just define the variable outside this function of your.

    Just before main function declare i.e.

    Double price;
    public static void main(String []args(){
    --------
    --------
    }
    

提交回复
热议问题