Core Java - Interview Questions and Answers

481. Which method can be used to enable/diable a checkbox menu item?

Ans : setState(boolean).

482. Which of the following may a menu contain?
a) A separator
b) A check box
c) A menu
d) A button
e) A panel

Ans : a and c.

483. Which of the following may contain a menu bar?
a) A panel
b) A frame
c) An applet
d) A menu bar
e) A menu

Ans : b.

484. What is the difference between a MenuItem and a CheckboxMenuItem?

Ans : The CheckboxMenuItem class extends the MenuItem class to support a menu item
that may be checked or unchecked.

485. Which of the following are true?
a) A Dialog can have a MenuBar.
b) MenuItem extends Menu.
c) A MenuItem can be added to a Menu.
d) A Menu can be added to a Menu.

Ans : c and d.

486. Which colour is used to indicate instance methods in the standard "javadoc" format documentation:
1) blue
2) red
3) purple
4) orange

Answer : 2
In JDK 1.1 the variabels, methods and constructors are colour coded to simplifytheir identification.

487.What is the correct ordering for the import, class and package declarations when found in a single file?
1) package, import, class
2) class, import, package
3) import, package, class
4) package, class, import

Answer : 1
explain :-
This is my explanation for question 2

488. Which methods can be legally applied to a string object?
1) equals(String)
2) equals(Object)
3) trim()
4) round()
5) toString()

Answer : 1,2,3,5

489. What is the parameter specification for the public static void main method?
1) String args []
2) String [] args
3) Strings args []
4) String args

Answer : 1,2

490. What does the zeroth element of the string array passed to the public static void main method contain?
1) The name of the program
2) The number of arguments
3) The first argument if one is present

Answer : 3

Post a Comment

Mới hơn Cũ hơn