Java Class and Object

A class is a template for an object, and an object is an instance of a class. Once a class is defined, this new type can be used to create objects of that type. The class is at the core of Java.

Continue reading


Java Constructors

Java allows objects to initialize themselves when they are created. This automatic initialization is performed through the use of a constructor. This fulfills the requirement for initialization of object upon creation.

Continue reading


Java Garbage Collection

Objects dynamically created using new operator are deallocated automatically. The technique that accomplishes this is called garbage collection. It works like this: when no references to an object exist, that object is assumed to be no longer needed, and the memory occupied by the object can be reclaimed.

Continue reading


Java String Class

The String class represents character strings. All string literals in Java programs, such as "abc", are implemented as instances of this class.

Continue reading


Java Nested Classes

The classes defined within another class are known as nested classes. The scope of a nested class is bounded by the scope of its enclosing class. Thus, if class B is defined within class A, then B does not exist independently of A.

Continue reading


Java Inheritance (IS-A)

When a class is derived from a base class, the derived class inherits all the characteristics of base class and can add new features as refinements and improvements. This is called inheritance.

Continue reading