Multiple choice technology programming languages

Which one of the following is a valid declaration of an applet?

  1. Abstract class MyApplet extends java.applet.Applet {

  2. Public class MyApplet extends java.applet.Applet {

  3. Class MyApplet implements Applet {

  4. Public class MyApplet extends applet implements Runnable {

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

A valid applet declaration must be a public class that extends java.applet.Applet (or javax.swing.JApplet for Swing). Option B correctly declares 'Public class MyApplet extends java.applet.Applet' (assuming 'Public' is a typo for 'public'). Option A incorrectly uses 'abstract', option C incorrectly uses 'implements', and option D incorrectly combines 'extends applet' (should be 'extends java.applet.Applet') with 'implements Runnable'.