Placing Constants in Interfaces
Interfaces and classes can also cooperate when it comes to defining constants. A constant is a field that is static and final.
Consider the definition of the classification of fireworks. In the United States, federal law defines two primary classifications, with each type of firework classified as either a consumer or a display type of firework. A display firework, any type of firework that is not a consumer firework, may be used only by licensed operators. In federal law, the consumer classification defines fireworks that states may allow ordinary citizens to purchase and to use. The consumer class is surprisingly large at the federal level, including rockets and aerial shells. State laws specify which consumer ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access