# One public type, one file, one matching name

Java has no headers, no translation units, and no forward declarations. A type is
declared once, in one place, and `javac` finds it by name.

Two rules carry almost all of it:

- A `public` type must sit in a file named after it. `public class Greeter` belongs in `Greeter.java`. Anything else is a compile error, and the error names the file it wanted.
- A file may hold extra types, as long as they are not `public`. They stay visible to their neighbours in the same package.

Declaration order buys you nothing. A class may use a type declared below it, or one in a file `javac` has not opened yet — names are resolved after everything is read.

You never say where a type lives. You write its name, and the compiler goes looking.
