【发布时间】:2021-02-13 17:56:33
【问题描述】:
class Bill{
int billid;
// **setter for the variable**
public void setbillid(int i){
billid=i;
}
// **getter for the variable**
public int getbillid(){
return billid;
}
}
public class Main{
public static void main(String[] args) {
// **This below is generating the error**
Bill b = new Bill();
System.out.println(b.getbillid);
}
}
符号:变量 setbillid
位置:Bill 类型的变量 b
【问题讨论】:
-
b.getbillid 是一种方法,而不是变量。你的语法错误,应该是 b.getbillid()
标签: java compiler-errors compilation