Unusual “static” method declaration

后端 未结 3 2004
感动是毒
感动是毒 2021-01-18 14:17
public class Card {

    public enum Rank { DEUCE, THREE, FOUR, FIVE, SIX,
        SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING, ACE }

    public enum Suit { CLUBS, D         


        
3条回答
  •  遇见更好的自我
    2021-01-18 14:57

    This is not a method, but a static Initializer block of a class. You can read more about it in the Java Language Specification.

    The code within is executed once after loading the class.

提交回复
热议问题