public class NotPermitted { sealed interface Payment permits Card, Upi {} record Card(long amount) implements Payment {} record Upi(long amount) implements Payment {} record Cheque(long amount) implements Payment {} // not in the permits clause }