 <p>In Java all classes with scope <code>public</code> must be save in file which name is exactly the same like name of this class. So if you have class named <code>Sample</code> it has to be saved in file named <code>Sample.java</code>. If class is named <code>Student</code> then file should be named <code>Student.java</code></p> <p>One of reason for this is that <code>packages</code> named and <code>class</code> names can be easly mapped to real system paths.</p>