当我尝试编译 Report.java 时,我在第 6 行收到错误消息:error: <identifier> expected aClient.setClientName("Michael");
带有和箭头指向第一个括号。
public class Client {
private String _clientName;
public String getClientName(){
return _clientName;
}
public void setClientName(String clientName){
_clientName = clientName;
}
}
public class Report {
Client aClient = new Client();
//ClientLawn aClientLawn = new ClientLawn();
aClient.setClientName("Michael");
//aClientLawn.setLawnWidth(10);
//aClientLawn.setLawnLength(10);
public void output(){
System.out.println(aClient.getClientName());
//System.out.println(aClientLawn.calcLawnSize());
}
}
我还想说明我是 Java 新手,所以请保持温和。