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

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -