Subscribe Us

Core Java - Interview Questions and Answers

431. What Checkbox method allows you to tell if a Checkbox is checked?

Ans : getState()

432. Which Component method is used to access a component's immediate Container?
a) getVisible()
b) getImmediate
c) getParent()
d) getContainer

Ans : c.

433. What methods are used to get and set the text label displayed by a Button object?

Ans : getLabel( ) and setLabel( )

434. What is the difference between a Choice and a List?

Ans : A Choice is displayed in a compact form that requires you to pull it down to see the list of available choices. Only one item may be selected from a Choice.
A List may be displayed in such a way that several List items are visible. A List supports the selection of one or more List items.

435. Which Container method is used to cause a container to be laid out and redisplayed?

Ans : validate( )

436. What is the difference between a Scollbar and a Scrollpane?

Ans : A Scrollbar is a Component, but not a Container.
A Scrollpane is a Container and handles its own events and performs its own
scrolling.

437. Which Component subclass is used for drawing and painting?

Ans : Canvas.

438. Which of the following are direct or indirect subclasses of Component?
a) Button
b) Label
c) CheckboxMenuItem
d) Toolbar
e) Frame

Ans : a, b and e.

439. Which of the following are direct or indirect subclasses of Container?
a) Frame
b) TextArea
c) MenuBar
d) FileDialog
e) Applet

Ans : a,d and e.

440. Which method is used to set the text of a Label object?
a) setText( )
b) setLabel( )
c) setTextLabel( )
d) setLabelText( )

Ans : a.

Post a Comment

0 Comments