Abstract Class In Java Example
Public static void main string args animal obj new dog.
Abstract class in java example. Class main public static void main string args dog d1 new dog. Abstract void printstatus. Abstract void printstatus no method body and abstract.
A method which is declared as abstract and does not have implementation is known as an abstract method. Cat c1 new cat. Example of abstract method.
Abstract class example abstract parent class abstract class animal abstract method public abstract void sound. Abstract method in java. Dog class extends animal class public class dog extends animal public void sound system out println woof.
Its subclasses which include hashmap treemap and concurrenthashmap share many methods including get put isempty containskey and containsvalue that abstractmap defines. An example of an abstract class in the jdk is abstractmap which is part of the collections framework.