In Java, how can I access static method parameters inside a new listener block?

前端 未结 1 754
失恋的感觉
失恋的感觉 2021-01-22 03:19

I have a static method that accepts a couple of parameters. Inside the method I am creating a new object and attaching a new listener to it. The problem is that the listener blo

相关标签:
1条回答
  • 2021-01-22 04:04

    Declare the parameters for the static method as final or assign the passed in arguments to final local variables in the static method before you create your listener. You can use the final references from inside the anonymous class definition.

    0 讨论(0)
提交回复
热议问题