upper and lower case static color names in Color

Discussion in 'Java' started by ChrisC, Aug 23, 2007.

  1. ChrisC

    ChrisC Guest

    Just out of curiosity, why are there duplicate colors, such as
    Color.red and Color.RED in the java Color class? Color.RED would be
    the standard notation for a static final...

    Chris
     
    ChrisC, Aug 23, 2007
    #1
    1. Advertisements

  2. The lower case names were in the original version of Java before they
    standardized on upper case names for the static finals. The upper case
    names were added in version 1.4. Use the upper case names for any new code.
     
    Knute Johnson, Aug 23, 2007
    #2
    1. Advertisements

  3. ChrisC

    Roedy Green Guest

    Just out of curiosity, why are there duplicate colors, such as
    It is historical. Originally they were all lower case. Then someone
    pointed out this violated the static final all upper case naming
    convention, and Sun fixed it. They had to leave the lower case names
    to avoid breaking existing code.
     
    Roedy Green, Aug 23, 2007
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.