Home / CSE MCQs / JAVA MCQs :: Discussion

Discussion :: JAVA MCQs

  1. What is the length of the application box made by this program?
    import java.awt.*;
    import java.applet.*;
    public class myapplet extends Applet {
    Graphic g;
    g.drawString("A Simple Applet", 20, 20);    
    }
  2. A.
    20
    B.
    Default value
    C.
    Compilation Error
    D.
    Runtime Error

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    To implement the method drawString we need first need to define abstract method of AWT that is paint() method. Without paint() method we can not define and use drawString or any Graphic class methods.


Be The First To Comment