Multiple choice

Which of the following statements is/are correct?

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

  1. A new color will be created.

  2. There will be a runtime exception.

  3. Parameters are not enough.

  4. There will be an error Compile time error : cannot find method color.

  5. Compile time error : Color is abstract, cannot create an object.

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

This is the correct answer because color 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.So this is the correct answer.