canb you have multiple classes inside one file code example
Example 1: Can we have multiple classes in single file
Yes we can have multiple classes in single file but it people rarely do that
and not recommended. We can have multiple classes in File but only one class
can be made public. If we try to make two classes in File public,
we get following compilation error.
“The public type must be defined in its own file”.
Example 2: creating multiple classes in file
Keep in mind that storing multiple classes per file is discouraged as a bad
practice. I strongly suggest that you split your fine into separate file per
class + one additional file with global functions