In the second case variable x is a class variable. It should be initialized at the time of definition. We can initialize a final instance variable inside the constructor but not class variable. So you will get a compile time error if you try to initialize a final class variable inside a constructor.
Non-Static(instance) variables are initialized at the time of object creation.so at first one u r not getting error
But in static members, these are initialized at Class loading time itself So in "static final int x;" x value must known to the compiler at the time of compilation it self.
i hope it will help u
Going along with Barry's example, the value of static variable is still assigned prior to the class instantiation (it is determined when the class loads since all static block initializers are executed at the time the class loads). Thus, it does not matter that the actual value is known at compile time for the static variable, just that it is assigned when the class loads and before object instantiation (when you class constructor method executes).