Question) Are you allowed to have more than one top level (non inner) class definition per source file?
Options)
Explanation) Yes you can have multiple top level class definitions per source file. Yeah, it's also true that the source file name must be same as that of the class name. To resolve both these constraints Java states some basic rules which are -
Options)
- No
- Yes
Explanation) Yes you can have multiple top level class definitions per source file. Yeah, it's also true that the source file name must be same as that of the class name. To resolve both these constraints Java states some basic rules which are -
- Out of the multiple top level classes defined only one can be public.
- Source file name must match this public class name.