218k views
3 votes
Assume you have an 800 by 600 applet window and that g is an object of the Graphics class.Which of the following commands will draw a diagonal line from the top-left corner to the bottom-right corner?

a. g.drawLine(0,0,799,599);
b. g.drawLine(0,0,599,799);
c. g.drawLine(0,799,0,599);
d. g.drawLine(799,599,0,0);
e. Both A and D

1 Answer

6 votes

Final answer:

The correct command to draw a diagonal line from the top-left corner to the bottom-right corner in an 800 by 600 applet window using the Graphics class is g.drawLine(0,0,799,599).

Step-by-step explanation:

The correct command to draw a diagonal line from the top-left corner to the bottom-right corner in an 800 by 600 applet window using the Graphics class is option e: g.drawLine(0,0,799,599).

Drawing diagonal lines in Java applets involves using the Graphics class, which provides methods for drawing shapes and lines.

User Nance
by
8.0k points