<div dir="ltr">Hello!<br><div><br></div><div>I wonder if we should enable instance main method if the class has only vararg constructor:</div><div><br></div><div>class Test {<br>  Test(String... data) {<br>  }<br><br>  void main() {<br>    System.out.println("Hello World!");<br>  }<br>}<br></div><div><br></div><div>Java 22 doesn't like it:</div><div>> \jdks\jdk-22\bin\java.exe --enable-preview Test.java</div><div>error: can't find no argument constructor in class: Test<br></div><div><br></div><div>However, in other contexts, such a class is considered as a class that has no-arg constructor. E.g., we can subclass it without explicit super-constructor invocation:</div><div><br></div><div>class Test {<br>  Test(String... data) {<br>  }<br><br>  static class Use extends Test {}<br>}<br></div><div><br></div><div>Would it be consistent to allow launching such classes?</div><div><br></div><div>With best regards,</div><div>Tagir Valeev</div></div>