Skip to content

Latest commit

 

History

History
22 lines (17 loc) · 408 Bytes

File metadata and controls

22 lines (17 loc) · 408 Bytes

Component Accessor Visibility

The accessor methods of a record are always public, so all the packages that can see the class can access its components.

package dungeon;

public record Dragon(double wingspan) {}
import dungeon.Dragon;

void main() {
    var dragon = new Dragon(224.5);
    IO.println(
        // Method is visible.
        dragon.wingspan()
    );
}