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

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

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

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