📜  Java中的main方法是强制性的吗? - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:29.950000             🧑  作者: Mango

代码示例1
// Java Program to demonstrate till Java JDK5 version
// without main() method is possible.
class WithoutMainMethod {
static {
int i = 2, j = 4, sum;
sum = i + j;
System.out.println("The sum of i and j is :" + sum);
System.out.println("This program is without main() valid till JDK 5 version");
}
}