Showing posts with label final. Show all posts
Showing posts with label final. Show all posts

Saturday, October 27, 2018

abstract and final

As an abstract method has no implementation, and a final method has the 'final' implementation, a method cannot be marked both abstract and final.

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.


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: