I think a "compile time constant" is just an abbreviation for what is called "compile time constant expression" in the language specification. The definition is found here: http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#5313 Especially note "Simple names that refer to constant variables (�4.12.4)." and the link leads to this definition: "We call a variable, of primitive type or type String, that is final and initialized with a compile-time constant expression (�15.28) a constant variable."
So, static or not, is not of interest. But the type of the variable should be a primitive or a String. Thanks for the question, as I also haven't been sure about what "compile time constant" means yet. But now I am
Regarding the code: Have you tried to compile it? I don't get an error at line2, I get an error at line3: "Type mismatch: cannot convert from short to byte"
edit: In short, you can say "compile time constants" are final variables of primitive type that are given a literal-value at the time of declaration. Literals itself are also called "compile time constant", so:
If I understood it right the variable i2 is a compile-time-constant, whereas i1 is not. That means i1 cannot be used as a case in a switch-statement, but i2 can. [ May 17, 2007: Message edited by: Sasha Ruehmkorf ]