Industrial Training

WIPRO Core Java Campus Interview Question Answer


How do I hide system properties that applets are allowed to read?

To hide the name of the operating system that you are using, add the following line to your <user home directory>/.hotjava/properties file: os.name=null


what is Applet Context?

Applet Context is an interface which provides information about applet?s environment


Can a applet invoke public methods of another applet on the same page?

Yes. It?s possible.


What are the steps involved in Applet development?

involved in Applet development:
* Create/Edit a Java source file. This file must contain a class which extends Applet class.
* Compile your program using javac
* Execute the appletviewer, specifying the name of your applet?s source file or html file. In case the applet information is stored in html file then Applet can be invoked using java enabled web browser.


What are the alternatives to using applets?

BEA supports the use of server-side applications with HTTP servlets and Java Server Pages (JSPs) as part of the J2EE platform. We recommend that before you develop new applications, consider using either servlets or JSPs. A well-designed series of interactive Web pages using servlets and Java Server Pages (JSPs) generally yield a faster and more reliable Web site.If you are currently using applets, you may find that most can be converted to Java applications using Java Web Start and you can continue using Web Logic Server. For information, go to Sun's Java Web Start site.


What is the life cycle of an applet?

init( ) method - called when an applet is first loaded start( ) method - called each time an applet is started paint( ) method - called when the applet is minimized or maximized stop( ) method - called when the browser moves off the applet's page destroy( ) method - called when the browser is finished with the applet


How does a server know when another server is unavailable?

Web Logic Server uses two mechanisms to determine if a given server instance is unavailable. Each Web Logic Server instance in a cluster uses multicast to broadcast regular "heartbeat" messages that advertise its availability. By monitoring heartbeat messages, server instances in a cluster determine when a serverinstance has failed. The other server instances will drop a server instance from the cluster, if they do not receive three consecutive heartbeats from that server instance Web Logic Server also monitors socket errors to determine the availability of a server instance. For example, if server instance A has an open socket to server instance B, and the socket unexpectedly closes, server A assumes that server B is offline.


what?s the applet security manager, and what does it provide?

The applet security manager is the Java mechanism for enforcing the applet restrictions described above. The applet viewer?s applet security manager is implemented by sun.applet.Applet Security.A browser may only have one security manager. The security manager is established at start up, and it cannot thereafter be replaced, overloaded, overridden, or extended. Applets cannot create or reference their own security manager.


If other languages are compiled to Java byte codes, how does that affect the applet security model?

The verifier is independent of Sun?s reference implementation of the Java compiler and the high-level specification of the Java language. It verifies byte codes generated by other Java compilers. It also verifies byte codes generated by compiling other languages into the byte code format. Byte codes imported over the net that pass the verifier can be trusted to run on the Java virtual machine. In order to pass the verifier, byte codes have to conform to the strict typing, the object signatures, the class file format, and the predictability of the run time stack that are all defined by the Java language implementation.


what happens when a user leaves and returns to an applet?s page?

When the user leaves the page, the browser stops the applet and when the user returns to the page, the browser starts the applet and normally most browser?s don?t initialize the applet again.


what are the restrictions imposed on an applet?

Due to Security reasons, the following restrictions are imposed on applets:
a. An applet cannot load libraries or define native methods.
b. It cannot ordinarily read or write files on the host that?s executing it.
c. It cannot make network connections except to the host that it came from.
d. It cannot start any program on the host that?s executing it.
e. It cannot read certain system properties.


what are untrusted applets?

By default, all downloaded applets are untrusted. Untrusted Applets are those applets which cannot access or execute local system files.


How to let a downloaded applet to read a file in the local system?

To allow any files in the directory /home/user1 to be read by applets loaded into the applet viewer, add the following line to your <user home directory>/.hot
java/properties file.
acl.read=/home/user1
you can specify one file to be read:
acl.read=/home/user1/somedir/somefile


How to let a downloaded applet to write to a file in the local system?

You can allow applets to write to your /tmp directory by setting the acl.write property in your <user home directory>/.hotjava/properties file:
acl.write=/tmp
You can allow applets to write to a particular file by naming it explicitly:
acl.write=/home/user1/somedir/somefile

Hi I am Pluto.