先来回顾下main方法组成结构:
public class Test {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}
main方法传入一个字符串,作为程序的入口,因此在调用main的时候,main中必须放入一个字符串。
参考如下:
public class Test {
public static void main(String[] args) {
System.out.println("Hello world!");
main(new String[0]);
}
}

成功运行。
版权声明:本文为m0_50654102原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。