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
More Related Contents:
- Initialize class fields in constructor or at declaration?
- Are arrays passed by value or passed by reference in Java? [duplicate]
- JPanel in puzzle game not updating
- Is there a way to instantiate a class by name in Java?
- Is there a way to access an iteration-counter in Java’s for-each loop?
- Executing a Java application in a separate process
- How to force Selenium WebDriver to click on element which is not currently visible?
- Marquee effect in Java Swing
- WebDriver open new tab
- Is there a Newline constant defined in Java like Environment.Newline in C#?
- How can I dynamically add items to a Java array?
- Apache PDFBox: problems with encoding
- Problems submitting a login form with Jsoup
- RejectedExecutionException inside single executor service
- Setting JVM/JRE to use Windows Proxy Automatically
- How do I get a HttpServletRequest in my spring beans?
- JFrame Exit on close Java
- Why is default required for a switch on an enum?
- Springfox 3.0.0 is not working with Spring Boot 2.6.0 [duplicate]
- Use of uninitialized final field – with/without ‘this.’ qualifier
- How to get day of the month?
- Suppress javac warning “…is internal proprietary API and may be removed in a future release”
- Multiplication of two ints overflowing to result in a negative number
- Today is nth day of year [duplicate]
- Convert String with Dot or Comma to Float Number
- How to mock RestTemplate in Java Spring?
- Java ArrayList how to add elements at the beginning
- Is it faster to access final local variables than class variables in Java?
- SWT components relayout after visibility set to false
- Why do we need to extend JFrame in a swing application?