To compile Foo.java: javac Foo.java
To run the program : java Foo
Why compiler needs .java suffix but interpre
The Java compiler takes a filename as input, hence Foo.java.
the Java interpreter takes the fully qualified class name and searches the classpath and current directory for the class. If you use java Foo.class it would search for the class named "class" in the package "Foo", and return NoClassDefFoundError if the class is in the default package, as I understand from your example