Skip to content

Interfaces, abstract classes, and Final

An interface describes public instance-method contracts. In Class Structure, mark a declaration as an interface and define its required signatures. Interfaces have no default method bodies. Their fields are public static final.

A class may implement multiple interfaces. A concrete implementation must provide compatible methods, including return/access/async contracts. An interface can be a Variable type, but cannot be constructed as an object.

For example, a Rewardable interface can require a public instance method Grant with a Player input and Void result. Different concrete reward classes can fulfill that contract with different behavior.

An abstract class can share state/behavior while leaving required methods for children. It can be used as a declared type but cannot be instantiated. A concrete subclass must complete its inherited requirements.

Choose abstract/interface status and implemented interfaces through Class Structure. These changes affect the draft and need compilation. Fix incompatible calls and constructors before expecting a new build to activate.

Toggle Final in a class editor to prevent subclasses. Final instance classes can still be instantiated and support overloaded methods. Abstract classes and interfaces cannot be Final. Static classes, including Main by default, are always Final and cannot implement instance contracts.

Method Settings → Final prevents a subclass from overriding the same signature or hiding a final static signature. Constructors and abstract/interface contracts cannot be Final. A different-parameter overload is a different signature.

Do not confuse these declaration modifiers with a Final Variable/field: declaration Final controls inheritance, while binding Final controls reassignment.