Cannot find symbol in java asking to create a class -


i having class defined follows:

public class myclass {     public int myvariable = 100;     if( myvariable > 0) {     } } 

why getting error in front of if condition stating cannot find symbol , symbol : class myvariable , location : class myclass <identifier> expected

i comparing value of integer variable 0 here. based on error, need create class. please let me know what's wrong here.

you need write statement inside executable block (method, static initializer, constructor etc)


Comments

Popular posts from this blog

css - I want to align grid in center -

python - SWIG function not printing output -

oop - Function for all prototypes - Javascript -