Applets in Java

Applets in Java

1). What is the difference between a window and a frame ?

A. A window is a frame without any borders and title, whereas a frame contains borders and title.

2. What is event delegation model ?

A. Event delegation model represents that when an event is generated by the user on a component,
it is delegated to a listener interface and the listener calls a mehtod in response to the event. Finally ,the event is handled by the method.

3. Which model is used to provide actions to AWT components ?

A. Event delegation model.

4. What is an adapter class ?

A. An adapter class is an implementation class of a listener which contains all methods
implemented with empty body. For example, WindowAdapter is an adapter class of WindowListener
interface. Adapter classes reduce overhead on programming while working with listener interfaces.

5. What is anonymous inner class ?

A. Anonymous inner class is an inner class whose name is not mentioned, and for which only one object is created.

6. What is the default layout in a frame ?

A. BorderLayout.

7. What is the default layout in an applet ?

A. FlowLayout.

8.What are Java Foundation classes ?

A. Java Foundation classes (JFC) represented a class library developed in pure Java which is an extension to AWT.

9. Discuss about the MVC architecture in JFC/ swing ?

A. Model- View – Controller is a model used in swing components. Model represents the data of
the component. View represents its appearance and controller is a mediater between the model and the
view.MVC represents the separation of model of an object from its view and how it is controlled.

10. What are the various window panes available in swing ?

A. There are 4 window panes: Glass pane, Root pane, Layered pane, and Content pane.

11. Where are the borders available in swing ?

A. All borders are available in BorderFactory class in javax.swing.border package.

12.What is applet life cycle ?

A. An applet is born with init( ) method and starts functioning with start( ) method. To stop the
applet, the stop( ) method is called and to terminate the applet completely from memory, the destroy( )
method is called. Once the applet is terminated, we should reload the HTML page again to get the
applet start once again from init( ) method. This cyclic way of executing the methods is called applet
life cycle.

13. Where are the applets executed ?

A. Applets are executed by a program called applet engine which is similar to virtual machine that
exists inside the web browser at client side.

14. What is HotJava?

A.Hot Java is the first applet-enabled browser developed in Java to support running of applets.

15. Which tag is used to embed an applet into a HTML page ?

A. <APPLET> tag is used to insert an applet into HTML page.

16. What is a generic type ?

A. A generic type represents a class or an interface that is type-safe. It can act on any data type.

17. Whai is erasure ?

A. Creating non-generic version of a generic type by the Java compiler is called erasure.

18. What is auto boxing ?

A. Auto boxing refers to creating objects and storing primitive data types automatically by the


Post a Comment