A Color class has three public accessor methods : getRed, getGreen, getBlue, that return that value (integer ) of the corresponding color component for that color.

1
A Color class has three public accessor methods : getRed, getGreen, getBlue, that return that value (integer ) of the corresponding color component for that color.

LANGUAGE: JAVA

CHALLENGE:

A Color class has three public accessor methods : getRed, getGreen, getBlue, that return that value (integer ) of the corresponding color component for that color.
The class AlphaChannelColor– a subclass of Color– has a default constructor .

Declare a variable of type AlphaChannelColor and initialize it to an AlphaChannelColor object created using the default constructor . Send the values of the red, green, and blue components (in that order and separated by spaces) to System.out

SOLUTION:

AlphaChannelColor acc = new AlphaChannelColor(); System.out.println(acc.getRed() + " " + acc.getGreen() + " " + acc.getBlue());

One comment

  • KenM66 says:

    The above is incorrect.

    This is the correct code.

    AlphaChannelColor acc = new AlphaChannelColor(); System.out.println(acc.getRed() + ” ” + acc.getGreen() + ” ” + acc.getBlue());

Add comment