Applet
- What is the length of the application box made by this program?
import java.awt.*;
import java.applet.*;
public class Newapplet extends Applet
{
Graphic G;
G.drawString("A Simple Applet created...",100,100);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
o implement the method drawString we need first need to define abstract method of AWT that is paint() method. Without paint() method we cannot define and use drawString or any Graphic class methods.
- What is the length of the application box made by this program?
import java.awt.*;
import java.applet.*;
public class TextApplet extends Applet
{
Graphic gra;
g.drawString("A Simple Applet", 30, 30);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
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.
- What is the length of the application box made by this program?
import java.awt.*;
import java.applet.*;
public class TextApplet extends Applet
{
public void paint(Graphics g)
{
g.drawString("A Simple Applet created...", 50, 50);
}
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
the code in paint() method – g.drawString(“A Simple Applet created...”,50,50); draws a applet box of length 50 and width 50.
- What is the Message is displayed in the applet made by this program?
import java.awt.*;
import java.applet.*;
public class TextApplet extends Applet
{
public void paint(Graphics g)
{
g.drawString("A Simple Applet created...", 40, 40);
}
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
A simple applet created...
(Output comes in a new java application)
- Which of these operators can be used to get run time information about an object?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
instanceof