Can a public class MyClass be defined in a source file named YourClass.java? Ans. No. The source file name, if it contains a public class, must be the same as the public class name itself with a .java extension.
Download the Study24x7 App, so you can connect and collaborate.