Multiple choice

Which of the following statements is/are correct?

Color c1 = new Color(284,60,189);

  1. A new colour will be created.

  2. runtime Exception

  3. Parameters are not enough

  4. Compile time error; cannot find method colour.

  5. Compile time error; colour is Abstract cannot create an object.

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

This is the correct answer because colour constructor creates a new colour, but it takes parameters in the range 0-255. But, here the value passed is 284(in first parameter). So, a runtime exception named “IllegalArgumentException” will be thrown by the JVM. Hence, this is the correct answer.