Question
Which of the following are true?
- A. If a package statement is included in a source code file, it must appear as the first non-blank line of source code.
- B. If an import statement is included in a source code file, it must appear as the first non-blank line of source code.
- C. If a
main()
method is included in a source code file, it must appear as the first non-blank line of source code. - D. If a public interface is declared in a source code file, it must have the same name as the source code file.
A and D.
Note
Package statements must appear as the first non-blank line of a source code file.
If a public class or interface is declared in a source code file, then the source code file must take the name of the public class or interface.
PreviousNextRelated