Over Riding

When in a method in the sub class has the same signature as that of the super class, the sub class method is set to over ride the super class method.
The six parts in the signature of a method are :

1)    Visibility Modifier
2)    Keyword
3)    Return Type
4)    Name
5)    Parameters
6)    Throws Conditions

The main rule of over riding that the signature of the method should be the same.
The two exceptions to this rule are :
1)    the overriding method can not be less accessible than the overridden method
2)    the over riding method can not throw super classes of the exception that is thrown by the overridden method.

class A
{
    public void met1()
    {
        System.out.println("A");
    }
}
class OverRidden extends A
{
    void met1()
    {
        System.out.println("OVERRIDDEN");
    }
    public static void main(String args[])
       {
        OverRidden o = new OverRidden();
        o.met1();
       }
}

OUTPUT :   Attempting to assign weaker access privilege.
Because overriding method OverRidden.met1(), has less accessibility (default) than the overridden method A.met1() (public).

class A
{
    public void met1()
    {
        System.out.println("A");
    }
}
class OverRidden extends A
{
    void met1()
    {
        System.out.println("OVERRIDDEN");
    }
    public static void main(String args[])
   {
        OverRidden o = new OverRidden();
        o.met1();
   }
}

OUTPUT : OVERRIDDEN