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.
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.
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.
finalize() method is also called Finalizer. It gets invoked when JVM figures out that this particular instance should be garbage collected. It may perform any operations, including bringing the object back to life.
Method overloading is one of the ways that Java supports polymorphism.
String class represents character strings. All string literals in Java programs, such as
"abc", are implemented as instances of this class.
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.
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.