title: Converting a color object to a string
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/9223903/how-to-print-string-representation-of-color-in-java">How To Print String representation of Color in Java</a>  </p>
  </blockquote>
  
  
  
  <p>I have a method called <code>getColor()</code> that returns a color (like <code>Color.BLACK</code>). Is there a way to convert <code>getColor()</code> into a string of its name?</p>
  
  <pre><code>String test = getColor().toString(); 
  </code></pre>
  
  <p>If <code>getColor()</code> returns <code>Color.BLACK</code>, then</p>
  
  <pre><code>String test = Color.BLACK.toString();
  System.out.println(test);
  </code></pre>
  
  <p><strong>OUTPUT</strong></p>
  
  <pre><code>java.awt.Color[r=0,g=0,b=0]
  </code></pre>