Hi,
These questions are from Jxam mock exam and i think given answers are not correct.
Q#1
Choose the class that can hold multiple equal objects in an ordered way.
A. Map
B. Collection
C. List
D. Set
E. Vector
Given answer is 'C' but List is not a class, it is a interface. Vector is a class that implements List interface. i think answer should be 'E'.
Q#2
Given the following definition:
String s = null;
Which code fragment will cause an exception of type NullPointerException to be thrown.
A. if ((s != null) & (s.length()>0))
B. if ((s != null) && (s.length()>0))
C. if ((s != null) | (s.length()>0))
D. if ((s != null) | | (s.length()>0))
Given answer are 'A','B','C','D'. but i think 'B' is not correct ( LHS will give u false then RHS will not be executed).
Q#3
Which of the following are defined in the Object class?
A. toString()
B. equals(Object o)
C. public static void main(String arg[])
D. System.out.println()
E. wait()
given answer are 'B' and 'E'. what is wrong with 'A'?
please do verify.
vivek
[This message has been edited by Vivek Shrivastava (edited August 05, 2000).]
[This message has been edited by Vivek Shrivastava (edited August 06, 2000).]