"ouch". Yes, it will work, but because it is a checked Exception it requires a "throws" or a "try-catch."
Go into your
Java folder on your PC, and explore it until you find a file called src.zip. Unzip that, find a method which throws an Exception, and examine that.
Find the java folder, in that the awt folder, in that the Color class, then inspect its constructors. See how they deal with Exceptions. Have a look at the Java Tutorial
here.