Question
How to create an implicit Java class in IDEA?
Answer
First, you need a project that uses Java 25 or later, where compact source files are a standard feature. Then, you can create just a file like 'test.java' via the menu <path>File | New | File </path> like this:
void main() {
println("Hello");
}
This file can be run via the run gutter icon before the method main.
Reference: Supported Java versions and features Simple source files and instance main methods
Learn more about Java 24 in IntelliJ IDEA
Comments
0 comments
Please sign in to leave a comment.