If you put multiple types in a single source file, only one can be public, and it must have the same name as the source file.
You can include non-public types in the same file as a public type, but only the public type will be accessible from outside of the package. All the top-level, non-public types will be package private.
To include non-public types in the same file as a public type is strongly discouraged, unless the non-public types are small and closely related to the public type.
Only one type in one source file!
댓글 없음:
댓글 쓰기