Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Java
final String planet = "Earth";
static final String planet = "Earth";

It is common and idiomatic (but not mandatory) to declare the constant as static, as a class member.
final String planet = "Earth";

Use this when it is a local variable; when contained within a method.
planet : constant String := "Earth";

New implementation...
< >
programming-idioms.org