Yogini,
A source file in Java is referred to as a "Compilation Unit". The JLS states in (�7.4) that "a compilation
unit consists of three parts each of which is optional":
i. A package declaration.
ii. Import declarations.
iii. Top level type declarations of class and interface types.
Therefore, since all parts of a compilation unit are optional an empty source file(compilation unit) is valid.
Hope this helps,
Bob Kerfoot -
SCJP