Introduction to OOP Chapter 4: Classes and Methods: next previous audio real text

Java Class Definition


class PlayingCard {
    public  int suit () { return suitValue; }
    public  int rank () { return rankValue; }

    private int suitValue;
    private int rankValue;

    public static final int Spade = 1;
    public static final int Diamond = 2;
    public static final int Club = 3;
    public static final int Heart = 4;
}

Java also applies visibility modifiers to each item indivually. Does not have enumerated data types, uses symbolic constants instead.
Intro OOP, Chapter 4, Slide 10