Classes and Interface

Rule 7: Design interfaces for posterity

Using interface to define constants in exposing the internal values of class being used. Instead of this Following can be done:

  1. 1.Use non-instantiable class(private constructor) with public static values.
    1. Note: You can use static imppport to avoid class.CONSTANT calling convention.
  2. if the constants are [enumerated type] put the CONSTANT in enum
  3. if the constants are specific to class put it into the CLASS or Interface itself


Published by

Unknown's avatar

sevanand yadav

software engineer working as web developer having specialization in spring MVC with mysql,hibernate

Leave a comment