DISTINQUISH BETWEEN THE JAVA CONTRUCTS: APPLICATION AND APPLETS. WRITE AN APPLICATON AND APPLETS PROGRAMS.
DISTINQUISH
BETWEEN THE JAVA CONTRUCTS: APPLICATION
AND APPLETS. WRITE AN APPLICATON AND APPLETS PROGRAMS.
CHAPTER ONE
Introduction
An applets
is a program written in the java programming language that can be include in an
HTML page, much in the same way an image is include in a page.
When you use a java technology- enabled browser to view a
page that contains an applet, the applet’s code is transferred to your system an
execute by the browser’s java virtual Machine (JVM).for information and
examples on how to include an applet in an HTML page, refers to this
description of tag.
An
Application at the other hand is more generic in scope and can include a
desktop such as Microsoft Word or a cloud based application such as Gmail.
Applets by in large are never mentioned unless relating to
the java implementation and concept. I addition applets are no longer as
popular as they once were due to other emerging web based technologies.
Using the
term Applet to refer to a small specific application that performs one specific
task may be accurate according to Wikipedia but would unfortunately fail in the
effective communication department.
DISTINQUISH BETWEEN THE JAVA CONTRUCTS: APPLICATION AND APPLETS. WRITE AN APPLICATON AND APPLETS PROGRAMS.
1 down Vote
Applets are
“small applications”. They very differ in “real applications” in the fact that
they normally are embedded in a narrow environment in which and only in which
they can function, implementing a very limited functionality.
The term applet is more often used for browsers, where the
<applet> tag is used in HTML to call java embedded application. Bandwidth
constraints forced such applications is to be rather small, while security
considerations forced them to be use only software already installed on the
computer, which for java is its runtime (JRE).
However,
this term is also used (or misused?) with an expanded scope, and may then
pertain to JavaScript, ActiveX, Flash or even HTML chunks (using the
<DIV> tag), but is not limited to these environments. It then refers to a
small and severely limited application with a small display (or none at all)
which requires very little local installation (none is preferred).
Exactly the same tools are used to compile applets as are
used to compile applications, so the only real difference in the end is the
applet’s small physical size, limited functionality and no need for local
installation.
CHAPTER TWO
THE DIFFERNCE BETWEEN
APPLICATON AND APPLET
The
difference between application and a java applet is how they are executed. An
Application is executed by a java interpreter that loads the application’s main
class file, whereas an Applet is executed through a java interpreter that works
with a browser and must be included on a Web page to run. Because java applets
are executed on the web user’s computer, certain restrictions limit what they
can do. If these restrictions were not in place, it would be easy to write java program capable of planting
viruses or violating the security of the Web user’s computer(for example,
by looking for Intuit’s Quicken programs
and then sending all of your credit card numbers to internet site.
In generally, most Web browsers place the following
restrictions on applets:
They cannot read or
write files to a user’s file system
They cannot make networks connections other to the host where
they originated.
They cannot start a program on the computer on which they are
running.
They cannot load program or library files that are stored on
the computer on which they are running.
A java application must have a main() method, which is where
the application starts to execute. An applet uses other methods, such as
init(), start(), stop(), and destroy(). However, it is possible to write a
class that can be used as both an application and an applet, because applets
ignore the main() method when they are executed.
CHAPTER THREE
AN APPLICATIONS PROGRAM
Below is an example of a very simple program
Import javax.swing.*;
Public class HelloWordSwing{
Public static void main(String[] args){
Final JLabel label = new JLabel(“HelloWordSwing”);
Frame.getContentPane().add(label);
Frame.setDefaultCloseOperation(JFrame.EXIST_ON_CLOSE);
Frame.pack();
Frame.setVisible(true);
}
}
CHAPTER FOUR
AN APPLES PROGRAM
import java.applet.*;
import java.awt.*;
public class main extends Applet{
public void paint(Graphics g){
g.drawString(“Welcome in java Applet.”40,20);
}
}
CHAPTER FIVE
CONCLUSION
Application
is a java class that has a main()method. An applet is a java class which
extends java.applet.Applet. Generally, application is a standalone program,
normally launched from the command line, and which has unrestricted access to
the host system. An applet is a program which is run in the context of an
applet viewer or web browser, and which has strictly limited access to the host
system.
For instance, an applet can normally not read or write files
on the host system whereas an application normally can. The actions of both
applets and applications can be controlled by Security Manager Objects.
Applets may communicate
with other applets running on the same virtual machine. If the applets are of
the same class, they can communicate via shared static variables. If the
applets are of different classes, then each will need a reference to the same
class with static variables.
Comments
Post a Comment