Não entendi porque a resposta D esta errada.
Compilei e rodei ela no Eclipse e não deu nenhum erro.
package sun.scjp;
public enum Color {
RED, GREEN, BLUE
}
package sun.beta;
// insert code here
public Class Beta{
Color g = GREEN;
public static void main(String[] args){
System.out.println(GREEN);
}
}
The class Beta and the enum Color are in different packages.
Which two code fragments, inserted individually at line 2 of the Beta
declaration, will allow this code to compile? (Choose two.)
A. import sun.scjp.Color.<em>;
B. import static sun.scjp.Color.</em>;
C. import sun.scjp.Color; import static sun.scjp.Color.<em>;
D. import sun.scjp.</em>; import static sun.scjp.Color.*;
E. import sun.scjp.Color; import static sun.scjp.Color.GREEN;
Resposta Certa: CE