ÈçÏÂ: 11. public class Rainbow{ 12. public enum MyColor{ 13. RED(OxffOOOO),GREEN(OxOOffDO),BLUE(OxOOOOff); 14. private final int rgb; 15. MyColor(int rgb){this.rgb=rgb;} 16. public int getRGB(){return rgb;} 17. }; 18. public static void main(String[] args){ 19.//insert code here }
}
which code fragment,inserted at line 19.allows the Rainbow class to complie? A.MyColor skyColor=BLUE; B.MyColor treeColor=MyColor GREEN; D.Compilation fails due to other error(s) in the code; F.MyColor purple=MyColor.BLUE+MyColor.RED;ÎÒ¿´¹ýÁË£¬µ«ÊǰﲻÁËÄ㣡²»ºÃÒâ˼£¡ B.MyColor treeColor=MyColor.GREEN; ÎÒÏëÖªµÀΪʲô£¬Äܽ²Ò»½²Óëö¾ÙÏà¹ØµÄ֪ʶµãÂð¡·£¿Ð»Ð»¡£ ÎÒÊÇÕâôÀí½âµÄ£¬°ÑËü¿´³ÉÒ»ÖÖÌØÊâµÄÀֻ࣬²»¹ýËûµÄʵÀý¶¼ÊÇÔÚÀïÃæ¶¨ÒåʵÀý»¯µÄ ÀýÈçRED(OxffOOOO),GREEN(OxOOffDO),BLUE(OxOOOOff); µ«ÊÇö¾ÙµÄÒ»°ãÊÇÕâÑùдµÄÂRainbow.MyColor.GREEN Ò»°ãÊÇÕâÑù×ÓдµÄ£ºMyColor.GREEN µ«ÒòΪÄãÕâ¸öö¾ÙÊÇRainbowÄÚ²¿µÄ£¬»á±»±àÒë³É¾²Ì¬µÄstatic ËùÒÔ¿ÉÒÔÕâô·ÃÎÊ Rainbow.MyColor.GREEN