Skip to content

Commit

Permalink
added AbstractStringBuilder as example of sealed class in the JDK sin…
Browse files Browse the repository at this point in the history
…ce Java 20
  • Loading branch information
homberghp committed Jan 26, 2024
1 parent ea969bd commit a75d3d7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion topics/sealedtypes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ abstract sealed class AbstractStringBuilder implements Appendable, CharSequence
}
----

<1> Meaning that since Java 20 you can no longer extend `AbstractStringBuilder`,
<1> The only allowed extenders of this class are `StringBuilder` and `StringBuffer`, meaning that since Java 20 you can no longer extend `AbstractStringBuilder`,
although that would be difficult anyway, because it is a package private class inside the package `java.lang` inside the module `java.base`.

In the code snippets below we give a complete example of a simple shape hierarchy.
Expand Down

0 comments on commit a75d3d7

Please sign in to comment.