Question No. 17 of the Subject goes like this: Which of the following are legal Java programs. Select all the correct answer. D) package pkg; import java.awt.*; Option 'D' is also given as correct. If only these two lines are available in the source file in what name the file is to be saved? And how can it be compiled and run?
Hi Thiru, An empty file is a valid Java program. The JVM only stipulates that the top-level class inside the file have the same name as the file itself (capitalization also). Since you have no class inside the file, the JVM performs no check; hence, no complaints! Regards, Manfred