这里有什么问题?Java:标识符预计
class UserInput {
public void name() {
System.out.println("This is a test.");
}
}
public class MyClass {
UserInput input = new UserInput();
input.name();
}
这抱怨:
<identifier> expected
input.name();
你缺少构造函数? – ChristopheD
你不能把'input.name();'放在任何你想要的地方,它必须在一个方法内。 –