What is the purpose of java.awt.Color.blue and java.awt.Color.BLUE

Why are there two constants Colordefined in a class java.awt.Color? For instance,

public static final Color blue;
public static final Color BLUE;

This is clearly redundant. Is there any specific use case - as a best practice, when upper case color is preferable than lower case Color or vice versa?

+5
source share
2 answers

This is a naming convention.

Java , . , Java: Color.black, Color.darkGray, Color.gray, Color.lightGray, Color.white, Color.magenta, Color.red, Color.pink, Color.orange, Color.yellow, Color.green, Color.cyan, Color.blue

Java 1.4 : Color.black, Color.DARK_GRAY, Color.gray, Color.LIGHT_GRAY, Color.white, Color.magenta, Color.red, Color.pink, Color.orange, Color.yellow, Color.green, Color.cyan, Color.blue

+5

. Java 1.4 (. 9) .

+3

All Articles