Can a public class MyClass be defined in a source file named YourClass.java?
Java Interview Questions and Answers (part 3)
(Continued from previous question...)
559. Can a public class MyClass be defined in a source file named YourClass.java?
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.
(Continued on next question...)
Other Interview Questions