Help the world stop coronavirus! Stay home!

Prev Next

Java / Class Variables (Static Variables)

How do I define a constant?

Posted on Apr 1, 2016 by Senthil Kumar.

The variable should be declared with static and final modifiers. static ensures that only one variable exists for all instances of the class and final makes its value not changeable once initialized.

static final int MAX_HEIGHT = 50;

❤Cash Back At Stores you Love !!!❤

Earn your $10 reward when you make your first purchase through Ebates by signing up with clicking below button.

Ebates Coupons and Cash Back

More Related questions...

Show more question and Answers...

Instance Variables (Non Static Variables)

Comments & Discussions