Yes, we can save a java file with an empty .java file name. You can compile it in the command prompt by ‘javac .java’ and run it by typing ‘java classname’. Here is an example of such a program:
import java.util.*;
class A
{
public static void main(String args[])
{
System.out.println("Hello World");
}
}
After saving the code, you need to open the command prompt and go to the directory where the file is stored. Then, you need to type ‘javac .java’ to compile the program, and ‘java A’ to run the program.