---
spec: JLS
title: "The Java Language Specification"
edition: "Java SE 16 Edition"
java_version: 16
chapter: "Chapter 13. Binary Compatibility"
section: "13.4.16"
heading: "13.4.16. abstract Methods"
parent: "13.4. Evolution of Classes"
source: https://docs.oracle.com/javase/specs/jls/se16/html/jls-13.html#jls-13.4.16
id: "13.4.16"
url: https://jvm.obfuscated.software/jls/se16/13.4.16.html
raw: https://jvm.obfuscated.software/jls/se16/13.4.16.md
---

# 13.4.16. `abstract` Methods

Changing a method that is declared `abstract` to no longer be declared `abstract` does not break compatibility with pre-existing binaries.

Changing a method that is not declared `abstract` to be declared `abstract` will break compatibility with pre-existing binaries that previously invoked the method, causing an `AbstractMethodError`.

**Example 13.4.16-1. Changing A Method To Be `abstract`**

```
class Super { void out() { System.out.println("Out"); } }
class Test extends Super {
    public static void main(String[] args) {
        Test t = new Test();
        System.out.println("Way ");
        t.out();
    }
}
```

This program produces the output:

```
Way
Out
```

Suppose that a new version of class `Super` is produced:

```
abstract class Super {
    abstract void out();
}
```

If `Super` is recompiled but not `Test`, then running the new binary with the existing binary of `Test` results in an `AbstractMethodError`, because class `Test` has no implementation of the method `out`, and is therefore is (or should be) `abstract`.
