Vidyalelo
Java Programming · Q75

Input Output

Programming · Java Programming · question 75

Q75

What is the length of the application box made by the following Java program? import java.awt.*; import java.applet.*; public class myapplet extends Applet public void paint(Graphics g) g.drawString("A Simple Applet", 20, 20);

A.
20
B.
50
C.
100
D.
System dependent
Answer

Answer: Option D

Solution

Answer: Option D
Solution:
The Java program provided uses the AWT and Applet classes to draw a string on the screen using the paint() method.

However, it does not explicitly specify the size (length or width) of the application box (applet window).

When an applet does not set its size using methods like setSize(), the actual size of the applet is determined by the HTML page that embeds the applet or by the applet viewer or browser displaying it.

Because different systems and viewers may allocate different default sizes, the length of the application box is therefore system dependent.