Answers for "Is the main method compulsory in Java?"

0

Is the main method compulsory in Java?

// 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");
}
}
Posted by: Guest on April-17-2021

Code answers related to "Is the main method compulsory in Java?"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language