classObject.getName()
is a method call, and the results of method calls are by definition not compile-time constants. A string literal is a compile-time constant.
Note that while many situations could take a static final
reference as a constant for the lifetime of the program, a switch
has to have its options hard-coded at compile-time. The value of a case
target must be either an enum value or a (compile-time) ConstantExpression.