Skip to content

Namespaces

In a Java method, each variable name can be declared only once.

  • You can have variables a and b, but not two variables both called a.

  • In a different method however, you can also have variables a and b.

Each method body is a namespace for its local variables.

namespace

A set of unique symbols allowing us to refer to things by name without ambiguity.

In a folder, we can have only one file of a given name.

  • You can have Hello.java and Hello2.java but not two files both named Hello.java.

In the filesystem, a directory is a namespace for filenames.


Prev -- Up -- Next