PPT Slide
Instance vs. Class Variables
Constants Revisited:
class ConstantExample
{
final int iMAXSIZE = 10;
} // of ConstantExample
Declares a different-but-identical constant for each instance of the class.
Wasteful with zero benefit.
Declares a single constant for use by all instances of the class.
class ConstantExample
{
static final int iMAXSIZE = 10;
} // of ConstantExample
Previous slide
Next slide
Back to first slide
View graphic version