A java program that is embedded in HTML document and runs in the context of java capable browser is known as ______.
applet
The question asks about a specific type of Java program that is designed to be placed directly within an HTML document and run within the environment of a web browser that supports Java. This concept was significant in the early days of the web for adding dynamic content to web pages.
A Java applet is exactly the type of program described. It is a small application written in the Java programming language that is intended to be included in an HTML web page. When a user views an HTML page that contains an applet, the code for the applet is downloaded to the user's browser, and a Java Virtual Machine (JVM) within the browser executes the applet.
Applets were used to provide interactive features that HTML alone could not support at the time, such as animations, complex calculations, or simple games, all running client-side within the user's browser.
Based on the definition provided in the question:
This precisely matches the definition and function of a Java applet.
Let's look at why the other options provided are not correct:
<canvas> element is an HTML5 element used for drawing graphics on a web page using scripting (typically JavaScript). It is not a Java program.java.awt.Frame or javax.swing.JFrame) is a top-level window in Java's graphical user interface (GUI) toolkits. While a Java application can have frame windows, this term doesn't specifically refer to a Java program embedded in HTML and running in a browser context.@param, @return, @author) are tags used within Java documentation comments (javadoc) to generate API documentation. They are not a type of Java program.Therefore, only 'applet' accurately describes a Java program embedded in an HTML document that runs in a Java-capable browser.
| Concept | Description | Runs in Browser? | Embedded in HTML? |
|---|---|---|---|
| Applet | A small Java program | Yes (requires Java plugin) | Yes (using <applet> or <object> tag) |
| Canvas | HTML5 element for graphics | Yes (rendered by browser) | Yes (is an HTML element) |
| Frame Window | Top-level GUI window in Java | No (part of standalone application) | No |
| Doctags | Javadoc comments tags | N/A | No |
While historically important, Java applets have largely become obsolete due to security concerns, difficulty in managing Java plugins in browsers, and the rise of alternative technologies like JavaScript, HTML5, CSS3, and WebAssembly for creating dynamic web content. Modern web development rarely uses applets.
To embed an applet in HTML, the <applet> tag was traditionally used, specifying the applet code (.class file) and dimensions. Later, the <object> tag became the standard.
Applets ran within a restricted security sandbox environment in the browser to prevent them from accessing local files or resources, though security vulnerabilities were sometimes discovered.
When an applet begins, which of the following sequence methods is CORRECT?
1) start()
2) paint()
3) init()
What will be the output of the following Java program?
class test
{public static void main (String args [ ])
{
System.out.println(20 + 30 + "Java");
System.out.println("Java" + 20 + 30);
}
}
In Java, the 'PreparedStatement' interface is a sub interface which is used to execute __________ query.
Which of the following is NOT a java primitive type?
Which of the following is/are the rules to declare variables in Java?