Solved

Consider the Following Code Fragment from the Italian Flag Program

Question 37

Multiple Choice

Consider the following code fragment from the Italian Flag program in How To 3.2: public class ItalianFlagComponent
{
Public void paintComponent(GraphicsG) {
Graphics2D g2 = (Graphics2d) g;
ItalianFlag flag = new ItalianFlag(100, 100, 90) ;
Flag.draw(g2) ;
}
}
Which of the following statements is true?


A) It is impossible to construct an ItalianFlagComponent because no constructor is implemented.
B) It is impossible to add an ItalianFlagComponent object to a frame because the class does not extend JComponent.
C) The code will not compile because it should have called g2.draw(flag) ;
D) The code has a syntax error and will not compile.

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions