Core Java Tutorials


Introduction

Java Hello World

Java Compilation

JDK New Features

JVM Architecture

Java OOPs Concepts

Java Package

Array

Exception Handling

String

Immutable Class

File Handling

Serialization

MultiThreading

Volatile

Concurrent Package

Collection

Collection Internal

Generics

Cloning

Reflection In Java

Annotation

Class Loader

Java Inner classes

Garbage Collector

JDBC

References In Java

Heap Dump & Thread Dump

Collection Framework in Java

The Java collections framework (JCF) is a set of classes and interfaces that implement commonly reusable collection data structures.

Collection framework was not part of original Java release. Collections was added to J2SE 1.2. Prior to Java 2, Java provided adhoc classes such as Dictionary, Vector, Stack and Properties to store and manipulate groups of objects. Collection framework provides many important classes and interfaces to collect and organize group of alike objects.

The Java Collections Framework is a collection of interfaces and classes which helps in storing and processing the data efficiently. This framework has several useful classes which have tons of useful functions which makes a programmer task super easy.

Collection class Hierarchy:


Rules for method overriding:

Signature of method added into subclass should be same as super class method.
The access level in subclass method cannot be more restrictive than the overridden method's define in super class.
An overriding method can throw any uncheck exceptions, regardless of whether the overridden method throws exceptions or not. However the overriding method should not throw checked exceptions that are new or broader than the ones declared by the overridden method. The overriding method can throw narrower or fewer exceptions than the overridden method.

Important points about method overriding:

Method overriding is implemented across two different classes with inheritance not within the same class.
A final method cannot be overridden.
A static method cannot be overridden but it can be re-declared.
Only inherited method can be overridden.
Constructors cannot be overridden since Constructors is not inherited.