Want to write articles/new answer to be published in javapedia.net? Send in your article with your name to javatutorials2016@gmail.com!

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