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