When you declare a final variable (constant) in a class, for example:

private static final int MyVar = 255;

How much memory will this require if I have 100,000 instances of the class which declared this?

Will it link the variable to the class and thus have 1*MyVar memory usage (disregarding internal pointers), or will it link to the instance of this variable and create 100,000*MyVar copies of this variable?

Unbelievably fast response! The consensus seems to be that if a variable is both static and final then it will require 1*MyVar. Thanks all!

Edit
Report