Multiple choice technology programming languages

Each source file should have a public class in it ?

  1. True

  2. False

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

A Java source file is not required to have any public class in it. It can contain only package-private classes, or even be empty. However, if a source file does contain a public class, the filename must match the name of that public class. Therefore, the statement is false.