Multiple choice technology programming languages

Why can't the whole program just consist of the one line that does the painting ?

  1. In Java, to create an applet, you can't call on functions without defining a class to call them.

  2. To appear on the web, Java must use an applet, and without first defining a class, you won't be painting onto anything.

  3. The drawString function is not defined without the "import" statements at the top.

  4. All of the above.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

In Java applets, painting requires a proper class structure extending Applet or JApplet to provide the drawing surface. Import statements are needed for graphics classes like Graphics. The drawString method must be called within a method like paint() that belongs to a properly defined applet class. All three reasons explain why a single painting line is insufficient.