I want to initialize a static Class variable in Java:
public class NumberExpression {
private static Class numberClass = Class.forName("java.lang.Number");
};
The above code segment doesn't work because Class.forName throws a ClassNotFoundException. Something like new Integer().getClass() won't work because Number is an abstract class.
I suppose I could wrap Class.forName around a static method that handles the ClassNotFoundException, but is there a more elegant/standard way of getting what I want?
Edit:
(class "Number" changed to "java.lang.Number")