How To Print String representation of Color in Java
问题 I have an array of colours of size n. In my program, the number of teams is always <= n, and I need to assign each team a unique color. This is my color array: private static Color[] TEAM_COLORS = {Color.BLUE, Color.RED, Color.CYAN, Color.GREEN, Color.ORANGE, Color.PINK}; When I print information about the players in the console, I want to print what color is associated with them. When I print the color, I get java.awt.Color[r=...,g=...,b=...]. I understand that this is how Java prints