Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#ffcccc
class Foo {
  static public final int VERSION = 1;
  // ...
}

Bar.java:

Code Block
bgColor#ffcccc
class Bar {
  public static void main(String[] args) {
    printf("You are using version " + Foo.VERSION);
  }
}

...

Foo.java:

Code Block
bgColor#ffcccc#ccccff
class Foo {
  static private final int version = 1;
  static public String getVersion() {
    return version;
  }

  // ...
}

Bar.java:

Code Block
bgColor#ccccff
class Bar {
  public static void main(String[] args) {
    printf("You are using version " + Foo.getVersion());
  }
}

...