Graphics class method to draw rectangle with specified width and height - AWT and Swing

Q.  In Graphics class which method is used to draws a rectangle with the specified width and height?
- Published on 22 Jul 15

a. public void drawRect(int x, int y, int width, int height)
b. public abstract void fillRect(int x, int y, int width, int height)
c. public abstract void drawLine(int x1, int y1, int x2, int y2)
d. public abstract void drawOval(int x, int y, int width, int height)

ANSWER: public void drawRect(int x, int y, int width, int height)

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)