Saturday 31 January 2015

Basic Java Swing Interview Questions and Answers

11. What is clipping?
Clipping is the bassically the process of confining paint operations to a limited area or shape.

12. Which containers use a border Layout as their default layout in swing?
many containers are there :
> The window,
> Frame and
> Dialog classes use a border layout as their default layout.

13. What is the preferred size of a component?
The preferred size of a component is the minimum component size, which  will be allow the component to display normally.

14. What method is used to specify a container's layout?
The setLayout() method is used to specify a container's layout.

15. Which containers use a FlowLayout as their default layout?
The Panel and Applet classes use the FlowLayout as their default layout.

16. Which method of the Component class is used to set the position and size of a component?
Method of the Component class is used to set the position and size of a component. hat is defined as :
setBounds

17. What is the What is the difference between invokeAndWait() and invokeLater()? 
Mnay diff are there which is defined as :
> 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.

18. Why should any swing call back implementation execute quickly?
Callbacks are invoked by the event dispatch thread. Event dispatch thread blocks processing of other events as long as call back method executes.

19. What is an applet?
Applet is bassically a java program that runs inside a web browser.

20. What is the difference between applications and applets?
Many diff are there : 
> 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.
More Questions & Answers :-

No comments:

Post a Comment