Basic Applet example question

Q.  The following example shows the creation of a
import java.applet.*;
import java.awt.*;

public class Main extends Applet{
public void paint(Graphics g){
g.drawString("Welcome in Java Applet.",40,20);
}
}

- Published on 19 Oct 15

a. Banner using Applet
b. Basic Applet
c. Display clock
d. None of the above

ANSWER: Basic Applet
 

    Discussion

  • Nirja Shah   -Posted on 15 Dec 15
    The above code is compiled and calls the generated class in the HTML code as follows:
    <HTML>
    <HEAD>
    </HEAD>
    <BODY>
    <div >
    <APPLET CODE="Main.class" WIDTH="800" HEIGHT="500">
    </APPLET>
    </div>
    </BODY>
    </HTML>

    The above code once compiled and generated will give the following output:
    Welcome in Java Applet.

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.)