Compile-time variabilities are decisions made at compile time. The compiler may take advantage of this information to optimize programs. Unfortunately, the Java language does not provide ideal facilities for simultaneously separating concerns between variabilities and commonalities and thus limits what can be accomplished. Compile-time variabilities may also be implemented with run-time mechanisms, but then you would lose any potential compile-time optimizations.
Example 7-1: MyConfig.java-an Example of Separating Compile-Time Constants from the Program
|
Example 7-2: MyFrame4.java-Using Compile-Time Constants in MyConfig.java
|
|
Example 7-10: JackAndJillCT.java
|