Java: Identifier expected
java
Solution
Put your code in a method.
Try this:
public class MyClass {
public static void main(String[] args) {
UserInput input = new UserInput();
input.name();
}
}
Then "run" the class from your IDE
Problem
What's the issue here? ``` class UserInput { public void name() { System.out.println("This is a test."); } } public class MyClass { UserInput input = new UserInput(); input.name(); } ``` This complains: ``` <identifier> expected input.name(); ```