View RSS Feed

Recent Blogs Posts

  1. Inner Classes

    by , 04-26-2012 at 05:01 PM
    Inner class has a link with enclosing class instance just the way with instance methods & variables. It also has a direct access to fields and methods of the object. Because of the association of the inner class with an instance, static member cant be defined by it.

    Inner classes instances i.e. object are present in outer class instance. Let us consider these classes:
    Java Code:
    class OuterClass {
        ...
        class InnerClass {
            ...
        }
    ...
    Categories
    Tutorial
  2. Outer and Inner classes

    by , 01-08-2012 at 11:47 AM
    All the classes in Java are not defined separately from other classes. You can also write one class into another class. The inside class is referred as inner class and the class containing this inner class is called outer class. Inner class is a member of outer class similar to other attributes and methods.

    Avoid using inner classes when they are not required. It is hard to maintain and reuse code with inner classes. Only use it when it is required and relevant. They are used usually ...
    Categories
    Classes