Saturday 31 January 2015

Top Java Swing Interview Questions and Answers

41. What is an event?
Event is bassically a changing the state of an object .

42. What is an event handler ?
An event handler is bassically is a part of a computer program, Which is created mainly for the programs, Its signifies the program how to act in response to a specific event.

43. Which containers use a border Layout as their default layout?
any containers are there which is use border layout as their default layout. that are fillowing as :
> The window,
> Frame and
> Dialog classes .

44. What method is used to specify a container's layout?
MAny methods are used to specify a container's layout But the main method is :
> The setLayout()

45. What is the difference between invokeAndWait() and invokeLater()? 
MAny diff are there which is defined as :
> InvokeAndWait : is synchronous. It blocks until Runnable task is complete.
> InvokeLater is asynchronous. It posts an action event to the event queue and returns immediately. It will not wait for the task to complete .

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

47. Which method is used by the applet to recognize the height and width?
Method is there :
> getParameters().

48. What is source and listener ?
They are defined as : 
> A source : It is an object that generates an event. This occurs when the internal state of that object changes in some way.
> A listener : It is an object that is notified when an event occurs. It has two major requirements.
    * It must have been registered with a source to receive notifications about specific event.
    * It must implement necessary methods to receive and process these notifications.

49. What is controls and what are different types of controls in AWT?
Controls are bassically a components, Which is allow a user to interact with your application.
AWT supports the following types of controls :
> Labels,
> Push Buttons,
> Check Boxes,
> Choice Lists,
> Lists,
> Scrollbars,
> Text Components.
These controls are subclasses of Component.

50. What is the difference between choice and list?
They are defined as : 
> A Choice : Choice is displayed in a compact form that requires us to pull it down to see the list of available choices and only one item may be selected from a choice.
> A List : It may be displayed in such a way that several list items are visible and it supports the selection of one or more list items.
More Questions & Answers :-

No comments:

Post a Comment