Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

What Is The Default Layout For A Contentpane In Jfc?

Answer»

The Defaulf LAYOUT for the ConteutPane in JFC is that :

  •  BorderLayout.

The Defaulf Layout for the ConteutPane in JFC is that :

2.

What Does Realized Mean?

Answer»

Realized MEAN basically is component, Which has been painted on screen or that is ready to be painted. REALIZATION can take PLACE by invoking any of these methods. Which are following as :

  •  SetVisible(true).
  •  SHOW() .
  •  Pack().

Realized mean basically is component, Which has been painted on screen or that is ready to be painted. Realization can take place by invoking any of these methods. Which are following as :

3.

What Is Difference Between Swing And Jsf?

Answer»

The key difference is that JSF runs on server, It needs a server like Tomcat or WEBLOGIC or WEBSPHERE. It displays HTML to the CLIENT. But SWING program is a stand alone application.

The key difference is that JSF runs on server, It needs a server like Tomcat or WebLogic or WebSphere. It displays HTML to the client. But Swing program is a stand alone application.

4.

Why Does Jcomponent Class Have Add() And Remove() Methods But Component Class Does Not?

Answer»

JComponent is a SUBCLASS of CONTAINER and can CONTAIN other COMPONENTS and JComponents.

JComponent is a subclass of Container and can contain other components and JComponents.

5.

What Is The Difference Between Awt And Swt?

Answer»

SWT : SWT is STANDS for STANDARD Widget Toolkit, It is a COMPLETELY independent Graphical User Interface (GUI) toolkit from IBM. They created it for the CREATION of Eclipse Integrated Development ENVIRONMENT (IDE).AWT is from Sun Microsystems.

SWT : SWT is stands for Standard Widget Toolkit, It is a completely independent Graphical User Interface (GUI) toolkit from IBM. They created it for the creation of Eclipse Integrated Development Environment (IDE).AWT is from Sun Microsystems.

6.

What Method Is Used To Specify A Container’s Layout?

Answer»

The SetLayout() method is BASICALLY USED to specify a CONTAINER’s LAYOUT.

The SetLayout() method is basically used to specify a container’s layout.

7.

What Is The Difference Between Jfc & Wfc?

Answer»

JFC supports ROBUST and portable user interfaces. The Swing CLASSES are robust, compatible with AWT, and provide you with a great deal of control over a user INTERFACE. Since source code is available, it is relatively easy to extend the JFC to do exactly what you need it to do. But the number of third­party controls written for Swing is still relatively small.
WFC runs only on the Windows (32­bit) user interface, and uses Microsoft extensions to Java for event handling and ActiveX integration. Because ActiveX components are available to WFC programs, there are theoretically more controls available for WFC than for JFC. In PRACTICE, HOWEVER, most ActiveX vendors do not actively support WFC, so the number of controls available for WFC is probably smaller than for JFC. The WFC programming model is closely aligned with the Windows platform.

JFC supports robust and portable user interfaces. The Swing classes are robust, compatible with AWT, and provide you with a great deal of control over a user interface. Since source code is available, it is relatively easy to extend the JFC to do exactly what you need it to do. But the number of third­party controls written for Swing is still relatively small.
WFC runs only on the Windows (32­bit) user interface, and uses Microsoft extensions to Java for event handling and ActiveX integration. Because ActiveX components are available to WFC programs, there are theoretically more controls available for WFC than for JFC. In practice, however, most ActiveX vendors do not actively support WFC, so the number of controls available for WFC is probably smaller than for JFC. The WFC programming model is closely aligned with the Windows platform.

8.

What Is The Difference Between A Canvas And A Scroll Pane?

Answer»
  • Canvas is a COMPONENT. ScrollPane is a CONTAINER
  • Canvas is a rectangular area where the application can DRAW or trap input events. ScrollPane implements horizontal and vertical SCROLLING.

 

 

9.

Which Is The Super Class Of All Event Classes?

Answer»

The java.AWT.AWTEvent CLASS is the highest­level class in the AWT event­class HIERARCHY.

The java.awt.AWTEvent class is the highest­level class in the AWT event­class hierarchy.

10.

How The Canvas Class And The Graphics Class Are Related?

Answer»

A Canvas OBJECT provides access to a Graphics object VIA its PAINT() METHOD.

A Canvas object provides access to a Graphics object via its paint() method.

11.

What Advantage Do Java’s Layout Managers Provide Over Traditional Windowing Systems?

Answer»

Java uses layout managers to lay out components in a consistent manner ACROSS all windowing platforms. Since Java’s layout managers aren’t TIED to ABSOLUTE sizing and positioning, they are able to accommodate platformspecific differences among windowing SYSTEMS.

Java uses layout managers to lay out components in a consistent manner across all windowing platforms. Since Java’s layout managers aren’t tied to absolute sizing and positioning, they are able to accommodate platformspecific differences among windowing systems.

12.

What Is The Diff Between Choice And The List?

Answer»

The difference are :

  • A Choice is displayed in a compact from that requires we to pull ot down tosee the list of available choice, Oly ONE item may be selected from a Choice.
  • A List may be dsplyaed in such a WAY that SEVERAL List items are VISIBLE. A List supports the selection of the one or more List items .

The difference are :

13.

Difference Between Paint() And Paintcomponent()?

Answer»

The KEY point is that the paint() method invokes three methods in the FOLLOWING order :

As a GENERAL rule, in Swing, we should be overriding the paintComponent method unless we know what we are doing paintComponent() paints only component (panel) but paint() paints component and all its CHILDREN.

The Key point is that the paint() method invokes three methods in the following order :

As a general rule, in Swing, we should be overriding the paintComponent method unless we know what we are doing paintComponent() paints only component (panel) but paint() paints component and all its children.

14.

What Are Types Of Applets?

Answer»

There are two different types of APPLETS. that are defined as :

  1.  Trusted Applets.
  2. UNTRUSTED applets.

Trusted Applets : are applets with PREDEFINED security.
Untrusted Applets : are applets WITHOUT any security.

 

There are two different types of applets. that are defined as :

Trusted Applets : are applets with predefined security.
Untrusted Applets : are applets without any security.

 

15.

What Are The Advantages Of The Event-delegation Model Over The Event-inheritance Model?

Answer»

Event-delegation model has two advantages over event-inheritance model. a)Event delegation model enables event handling by objects other than the ones that generate the events. This allows a clean separation between a COMPONENT's DESIGN and its use. b)It performs MUCH better in applications where many events are GENERATED. This performance improvement is DUE to event-delegation model does not have to be repeatedly process unhandled events as is the case of the event-inheritance.

Event-delegation model has two advantages over event-inheritance model. a)Event delegation model enables event handling by objects other than the ones that generate the events. This allows a clean separation between a component's design and its use. b)It performs much better in applications where many events are generated. This performance improvement is due to event-delegation model does not have to be repeatedly process unhandled events as is the case of the event-inheritance.

16.

What Is An Event And What Are The Models Available For Event Handling?

Answer»

Changing the state of an object is called an event. An event is an event object that DESCRIBES a state of change. In other WORDS, event occurs when an action is generated, like pressing a key on KEYBOARD, clicking mouse, etc. There different types of MODELS for handling EVENTS are event-inheritance model and event-delegation model

Changing the state of an object is called an event. An event is an event object that describes a state of change. In other words, event occurs when an action is generated, like pressing a key on keyboard, clicking mouse, etc. There different types of models for handling events are event-inheritance model and event-delegation model

17.

What Is The Lifecycle Of An Applet?

Answer»
  • 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

18.

When We Should Go For Codebase In Applet?

Answer»

If the APPLET CLASS is not in the same DIRECTORY, CODEBASE is USED.

If the applet class is not in the same directory, codebase is used.

19.

Which Method Is Used By The Applet To Recognize The Height And Width?

Answer»

getParameters()
METHOD is USED by the applet to RECOGNIZE the HEIGHT and WIDTH.

getParameters()
Method is used by the applet to recognize the height and width.

20.

What Is The Difference Between Applications And Applets?

Answer»

Application MUST be run explicitly within Java VIRTUAL Machine whereas applet loads and runs itself automatically in a java-enabled browser. Application starts execution with its main method whereas applet starts execution with its INIT method. Application can run with or without GRAPHICAL user interface whereas applet must run within a graphical user interface. In order to run an applet we need a java enabled web browser or an APPLETVIEWER.

Application must be run explicitly within Java Virtual Machine whereas applet loads and runs itself automatically in a java-enabled browser. Application starts execution with its main method whereas applet starts execution with its init method. Application can run with or without graphical user interface whereas applet must run within a graphical user interface. In order to run an applet we need a java enabled web browser or an appletviewer.

21.

What Is An Applet?

Answer»

Applet is a JAVA program that RUNS inside a web BROWSER.

Applet is a java program that runs inside a web browser.

22.

Why Should Any Swing Call Back Implementation Execute Quickly?

Answer»

Callbacks are invoked by the event dispatch THREAD. Event dispatch thread blocks PROCESSING of other events as LONG as CALL back method executes.

Callbacks are invoked by the event dispatch thread. Event dispatch thread blocks processing of other events as long as call back method executes.

23.

What Is The What Is The Difference Between Invokeandwait() And Invokelater()??

Answer»

invokeAndWait() method in swing is SYNCHRONOUS. It BLOCKS until Runnable TASK is complete. InvokeLater() method in swing is asynchronous. It posts an action event to the event queue and returns immediately. It will not wait for the task to complete.

invokeAndWait() method in swing is synchronous. It blocks until Runnable task is complete. InvokeLater() method in swing is asynchronous. It posts an action event to the event queue and returns immediately. It will not wait for the task to complete.

24.

Which Containers Use A Border Layout As Their Default Layout In Swing?

Answer»

The WINDOW, FRAME and Dialog CLASSES use a border layout as their DEFAULT layout.

The window, Frame and Dialog classes use a border layout as their default layout.

25.

What Is Double Buffering?

Answer»

Double buffering is the PROCESS of use of two buffers rather than one to temporarily hold DATA being moved to and from an I/O device. Double buffering increases data TRANSFER speed because one BUFFER can be filled while the other is being emptied.

Double buffering is the process of use of two buffers rather than one to temporarily hold data being moved to and from an I/O device. Double buffering increases data transfer speed because one buffer can be filled while the other is being emptied.

26.

What Are Heavyweight Components?

Answer»

A HEAVYWEIGHT COMPONENT is one that is associated with its own NATIVE screen resource (COMMONLY known as a PEER).

A heavyweight component is one that is associated with its own native screen resource (commonly known as a peer).