Expert Answers

  1. Look at the following code:
    Color c = Color.BLUE;
    What is BLUE?

2. What is the length of the line being drawn?
g.drawline( 50, 20, 50, 350 );

3. What is the (x,y) coordinate of the lower-right corner of the rectangle being drawn?
g.drawRect( 10, 20, 250, 350 );

4. This code draws the “Fill in the Code” with the lower-left corner of the first character (the F) being at the coordinate (100, 250).
5. Where is the error in this code sequence?
// we are inside method paint
g.setColor( GREEN );

6. You coded the following on line 10 of the class MyApplet.java:
Color c = Color.Blue; // line 10
When you compile, you get the following message:
MyApplet.java:10: cannot find symbol
Color c = Color.Blue; // line 10
^

symbol : variable Blue
location: class Color
1 error
Explain what the problem is and how to fix it.