Posts

Showing posts with the label abstract modifier in Java.(abstract method and class)

Abstract classes and Abstract methods in Java with Examples rcub.

  Abstract class : A class which is declared with the abstract keyword is known as an abstract class. The partially implemented class is called as abstract class. It is used for abstraction. we cannot create object for abstract class. Syntax : public abstract class <classname> { <abstract methods>; <non-abstract methods>; } Example : abstract class A {    abstract void area();      A()     {     System.out.println("welcome");      }      static  void show()    {      System.out.println("static method");      }      } Abstract Method : A method which is declared as abstract and does not have implementation is known as an abstract method. The method contains only declaration. Syntax : abstract type name(parameter-list); Example : abstract void...