Given a Graphics object g, to draw a line from the upper left corner to the bottom right corner, you use __.

Given a Graphics object g, to draw a line from the upper left corner to the bottom right corner, you use __________.


A. g.drawLine(0, 0, 100, 100)
B. g.drawLine(0, 0, getWidth(), getHeight())
C. g.drawLine(0, 0, getHeight(), getHeight())
D. g.drawLine(0, 0, getWidth(), getWidth())

The correct answer is B


Java

Learn More Multiple Choice Question :