Name

final

Description

Keyword used to state that a value, class, or method can't be changed. If the final keyword is used to define a variable, the variable can't be changed within the program. When used to define a class, a final class cannot be subclassed. When used to define a function or method, a final method can't be overridden by subclasses.

This keyword is an essential part of Java programming and is not usually used with Processing. Consult a Java language reference or tutorial for more information.

Examples

  • final float constant = 12.84753;
    println(constant);  // Prints "12.84753" to the console
    constant += 12.84;  // ERROR! It's not possible to change a "final" value
    
Creative Commons License

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.