How to Abstract Class with Abstract Methods in Java


In this example we will show how to abstract class with abstract methods in Java.

Source Code

package com.beginner.examples;

public class AbstractClass {

  String name = "test";
  public void test(){
    System.out.println("OK");
  }
  public static void main(String[] args) {
    AbstractClass a = new AbstractClass();
    System.out.print(a.name);
    a.test();// call abstract method
    
  }
}

Output:

test
OK
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments