View RSS Feed

Java Object

Nested Classes

Rate this Entry
by , 04-26-2012 at 05:56 PM (518 Views)
A class can be defined without other class by the Java programming language. Suck kind of class is known as nested class, which has been illustrated below:
Java Code:
class OuterClass {
    ...
    class NestedClass {
        ...
    }
}

class OuterClass {
    ...
    static class StaticNestedClass {
        ...
    }
    class InnerClass {
        ...
    }
}
Enclosing class has a member known as the nested class. Non static inner classes/nested classes do have the access to enclosing class’s other members no matter they have been declared to be private. Static nested classes have no access to enclosing class’s members. Bein Outerclass member, nested class might be declared to be a protected, public, private or package private.

Submit "Nested Classes" to Facebook Submit "Nested Classes" to Digg Submit "Nested Classes" to del.icio.us Submit "Nested Classes" to StumbleUpon Submit "Nested Classes" to Google

Categories
Tutorial

Comments