Because you didn’t reference the variable using an object reference in your validClientId()
method (as described by T McKeown’s answer), your code is looking within the scope of the validClientId()
method itself to find that variable. It can’t find it because the variable hasn’t been declared within that scope. Try including the object reference as described by T McKeown to force the compiler to look within the this
object for that variable.
Also, your class brackets aren’t closed. This might just be a problem with your example code, but you need a closing curly brace }
0
solved Class level variable? [closed]