Choose the correct option based on the following program:.
class Color { int red, green, blue; Color() {/*from w ww. ja v a 2 s .co m*/ this(10, 10, 10); } Color(int r, int g, int b) { red = r; green = g; blue = b; } public String toString() { return "The color is: " + red + green + blue; } public static void main(String [] args) { System.out.println(new Color()); } }
C.
The toString()
implementation has the expression "the color is:" + red + blue + green.
Since the first entry is string, the + operation becomes the string concatenation operator with resulting string "the color is: 10".
There is a concatenation operator + and so on until finally it prints "the color is: 101010".