Suppose that I have written the following class:

public class Thing
{
    public Thing()
    {
        // This constructor intentionally does nothing.
    }

   // In fact, this whole class intentionally does nothing.
}

What do I have to name the file that contains this class in order for it to compile in Java?

Thing.java
  • thing.java
  • It can be named anything; the file's name does not matter.
  • It can be named either "Thing.java" or "thing.java".

Each public Java class must be placed in a file with the same name as the class, with ".java" added on the end. Capitalization matters.