Code Download :: EnumDemo.zip
"Enum Types (The Java™ Tutorials > Learning the Java Language > Classes and Objects)" ( http://bit.ly/15sJydz )
Showing posts with label Constant. Show all posts
Showing posts with label Constant. Show all posts
Thursday, April 18, 2013
Sunday, May 27, 2012
What is a Constant? Final keyword
DOWNLOAD THE CODE: FinalValuePkg
We can store a value in a constant. Very similar to a variable except that a constant has a constant value. That is, the stored value is never changed as a result of processing.
Constants are used where a value should never be changed such as a maximum, minimum, number of hours in a day, days in a week, etc.
A constant begins with the keyword final. Just as with a variable, a type & identifier must be given.
CIRCLE_WIDTH and CIRCLE_HEIGHT are defined using uppercase and have each been assigned a value.
"Java Syntax: Declaring and Using Constants in Java" ( http://bit.ly/JmgF5S )
Here's a cat:
We can store a value in a constant. Very similar to a variable except that a constant has a constant value. That is, the stored value is never changed as a result of processing.
Constants are used where a value should never be changed such as a maximum, minimum, number of hours in a day, days in a week, etc.
A constant begins with the keyword final. Just as with a variable, a type & identifier must be given.
The compiler will not allow any processing statements to change the values of these constants.
UML Class Diagram Notation
The UML Class Diagram notation for a constant (final) is as below:
CIRCLE_WIDTH and CIRCLE_HEIGHT are defined using uppercase and have each been assigned a value.
"Java Syntax: Declaring and Using Constants in Java" ( http://bit.ly/JmgF5S )
Here's a cat:
Subscribe to:
Posts (Atom)



