Abstract Example

abstract class Animals
{
    public void animalName(String name)
               {
                  System.out.println("My Name is"+name);
                }
abstract void animalAge(int age);
abstract void animalType();

}

class Group extends Animals
{

//If All abstract methods of abstract class is not implemented then class should make abstract

void animalAge(int age)
{
    System.out.println("My Age is"+age);
}


}

class Main
{

public static void main(String args[])
          {

 Group obj=new Group();//Error Class Group is not abstract class


     }

}

Comments