Error in java calculator programme “Field ‘(button)’ may be ‘final’ [closed]

Tags: ,



I am creating gui calculator in Java

I am using IDEA

programme runs successfully but it shows an error that Field ‘(any field)’ may be ‘final’……

I don’t know what it is

Here is image of Error

Answer

It’s a warning/information message telling you that these variables are better to be declared as final. Whenever your IDE finds cases where you have not assigned anything to a variable, except at the time of initialization, it may give you such a warning/information message so that you can consider adjusting the code if required. I believe, you already understand the concept of the keyword, final in Java.



Source: stackoverflow