display | more...

An object oriented programming concept from the Java programming language. Essentially you create a class inside of another class. The inner and outer class both have a heightened level of access each to each other, and the inner class is only accessible from the outer. An example:

class Outer
{
int whatever;
class Inner
{
public Inner() { System.out.println("Inner class.");
}

Inner i = new Inner();

}

You get the idea.

When inner classes were first added to Java, the term top-level inner class meant a static nested class.

People rightly found that terminology incredibly confusing, so they changed the naming convention to top-level nested class and inner class. The JVM attributes had already been defined in the spec, so these names couldn't be changed. It's another wart on the Java language, like the super bit on classes that is a workaround for a bug in JDK 1.0, but it's nothing to get upset about.

The new, non-confusing terminology is:

It is worth pointing out this new terminology because having a mixture of the old and new terminologies is even more confusing than the already confusing old terminology.

Thanks to schapel of the JDC for
bringing up this bit of knowledge.

Log in or register to write something here or to contact authors.