Every Java program requires the presence of at least one class.
Is the above statement always true ?
JAVA required at least one class in a program because at the time of execution of Java programs we needed to provide the name of a class which contains the main () method.
so, it is compulsory to provide at least one class name to Java programs.
ex--->`
class Test
{
public static void main(String [] args)
{
System.out.println("Hello World");
}
}
so, javac _____ ("Here we have to give the name of java program in which we save")
java ______ ("Provide the name of a class which contain the main() method")
-----> according to our program
javac Hello (here I save the program name by Hello.java)
java Test (because Test class contains main() method)
Thank You