I am having a class defined as follows:
public class Myclass {
public int myvariable = 100;
if( myvariable > 0) {
}
}
Why I am getting an error in front of if condition
stating that cannot find symbol , symbol : class myvariable , location : class Myclass <identifier> expected
I am just comparing the value of integer variable with 0 here. Based on the error, I would need to create a class. Please let me know what's wrong here.
您需要在可执行块(方法,静态初始化程序,构造函数等)中编写语句
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.